﻿#include "detectionanalysis.h"
#include "ui_detectionanalysis.h"

extern QString afiletype;
extern QString afilepath;
extern QStringList STRType;
extern QStringList STRName;
extern QStringList STRsys;

class ReadOnlyDelegate: public QItemDelegate
{

public:
    ReadOnlyDelegate(QWidget *parent = NULL):QItemDelegate(parent)
    {}

    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
                          const QModelIndex &index) const override //final
    {
        Q_UNUSED(parent)
        Q_UNUSED(option)
        Q_UNUSED(index)
        return NULL;
    }
};

QSize CustomTabStyle3::sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const
{
    QSize s=QProxyStyle::sizeFromContents(type,option,size,widget);
    if(type==QStyle::CT_TabBarTab){
        s.transposed();
        s.rwidth()=168;
        s.rheight()=50;
    }
    return s;
}
void CustomTabStyle3::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
    if(element==CE_TabBarTabLabel){
        if(const QStyleOptionTab *tab=qstyleoption_cast<const QStyleOptionTab *>(option)){
            QRect allRect=tab->rect;
            if(tab->state&QStyle::State_Selected){
                painter->save();
                painter->setPen(0x89cfff);
                painter->setBrush(QBrush(0x89cfff));
                painter->drawRect(allRect.adjusted(6,6,-6,-6));
                painter->restore();
            }
            QTextOption option;
            option.setAlignment(Qt::AlignCenter);
            if(tab->state&QStyle::State_Selected){
                painter->setPen(0xf8fcff);
            }else{
                painter->setPen(0x000001);
            }
            painter->drawText(allRect,tab->text,option);
            return ;
        }
    }
    if(element==CE_TabBarTab){
        QProxyStyle::drawControl(element,option,painter,widget);
    }
}

DetectionAnalysis::DetectionAnalysis(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::DetectionAnalysis)
{
    ui->setupUi(this);
    ui->tabWidget->tabBar()->setStyle(new CustomTabStyle3);
    ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
    ui->tableWidget->verticalHeader()->setDefaultSectionSize(50);
    ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
    ui->tableWidget_2->verticalHeader()->setDefaultSectionSize(50);
}

DetectionAnalysis::~DetectionAnalysis()
{
    delete ui;
}

void DetectionAnalysis::showEvent(QShowEvent *event)
{
    tab2();
    tab1();
    datain();
    ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
    ui->tableWidget->verticalHeader()->setDefaultSectionSize(50);
    ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
    ui->tableWidget_2->verticalHeader()->setDefaultSectionSize(50);
    ui->pushButton->setText("总数:"+QString::number(ui->tableWidget_2->rowCount()-2));
    int c=0,y=0,m=0,xs=0;
    for(int i=2;i<ui->tableWidget_2->rowCount();i++){
        if(ui->tableWidget_2->item(i,3)->text().contains("常STR")){
            c++;
        }
    }
    ui->pushButton_2->setText("常STR:"+QString::number(c));
    if(STRType.contains("Y-STR")){
        ui->pushButton_3->setText("Y-STR:"+QString::number(ui->tableWidget_2->rowCount()-2));
    }else{
        ui->pushButton_3->setText("Y-STR:"+QString::number(0));
//        ui->pushButton_3->setText("Y-STR:"+QString::number(ui->tableWidget_2->rowCount()-2));
    }

    for(int i=2;i<ui->tableWidget_2->rowCount();i++){
        if(ui->tableWidget_2->item(i,3)->text().contains("mini-STR")){
            m++;
        }
    }
    ui->pushButton_4->setText("mini-STR:"+QString::number(m));
    for(int i=2;i<ui->tableWidget_2->rowCount();i++){
        if(!ui->tableWidget_2->item(i,4)->text().contains("无")){
            xs++;
        }
    }
    ui->pushButton_5->setText("需稀释样本数量:"+QString::number(xs));
    tabifl=1;
    for(int i=0;i<ui->tableWidget_2->rowCount();i++){
        ReadOnlyDelegate* readOnlyDelegate = new ReadOnlyDelegate(this);
        ui->tableWidget_2->setItemDelegateForColumn(i, readOnlyDelegate);
    }
    for(int i=0;i<ui->tableWidget->rowCount();i++){
        ReadOnlyDelegate* readOnlyDelegate = new ReadOnlyDelegate(this);
        ui->tableWidget->setItemDelegateForColumn(i, readOnlyDelegate);
    }
}

//总数
void DetectionAnalysis::on_pushButton_clicked()
{
    ui->pushButton->setStyleSheet("background: rgba(255,255,255,0);color: #2F42CD;");
    ui->pushButton_2->setStyleSheet("background: rgba(255,255,255,0);");
    ui->pushButton_3->setStyleSheet("background: rgba(255,255,255,0);");
    ui->pushButton_4->setStyleSheet("background: rgba(255,255,255,0);");
    ui->pushButton_5->setStyleSheet("background: rgba(255,255,255,0);");
    datain();
    tab2xh();
    tabifl=1;
}

//
void DetectionAnalysis::on_pushButton_2_clicked()
{
    ui->pushButton_2->setStyleSheet("background: rgba(255,255,255,0);color: #2F42CD;");
    ui->pushButton->setStyleSheet("background: rgba(255,255,255,0);");
    ui->pushButton_3->setStyleSheet("background: rgba(255,255,255,0);");
    ui->pushButton_4->setStyleSheet("background: rgba(255,255,255,0);");
    ui->pushButton_5->setStyleSheet("background: rgba(255,255,255,0);");
    datain();
    for(int i = ui->tableWidget_2->rowCount() - 1; i >= 2; --i){
        if(!ui->tableWidget_2->item(i, 3)->text().contains("常STR")){
            ui->tableWidget_2->removeRow(i);
        }
    }
    tab2xh();
    tabifl=2;
}

void DetectionAnalysis::on_pushButton_3_clicked()
{
    ui->pushButton_3->setStyleSheet("background: rgba(255,255,255,0);color: #2F42CD;");
    ui->pushButton_2->setStyleSheet("background: rgba(255,255,255,0);");
    ui->pushButton->setStyleSheet("background: rgba(255,255,255,0);");
    ui->pushButton_4->setStyleSheet("background: rgba(255,255,255,0);");
    ui->pushButton_5->setStyleSheet("background: rgba(255,255,255,0);");
    YSTRfl=true;
    datain();
    for(int i = ui->tableWidget_2->rowCount() - 1; i >= 2; --i){
        if(!ui->tableWidget_2->item(i, 3)->text().contains("Y-STR")){
            ui->tableWidget_2->removeRow(i);
        }
    }
    YSTRfl=false;
    tab2xh();
    tabifl=3;
}

void DetectionAnalysis::on_pushButton_4_clicked()
{
    ui->pushButton_4->setStyleSheet("background: rgba(255,255,255,0);color: #2F42CD;");
    ui->pushButton_2->setStyleSheet("background: rgba(255,255,255,0);");
    ui->pushButton_3->setStyleSheet("background: rgba(255,255,255,0);");
    ui->pushButton->setStyleSheet("background: rgba(255,255,255,0);");
    ui->pushButton_5->setStyleSheet("background: rgba(255,255,255,0);");
    datain();
    for(int i = ui->tableWidget_2->rowCount() - 1; i >= 2; --i){
        if(!ui->tableWidget_2->item(i, 3)->text().contains("mini-STR")){
            ui->tableWidget_2->removeRow(i);
        }
    }
    tab2xh();
    tabifl=4;
}

void DetectionAnalysis::on_pushButton_5_clicked()
{
    ui->pushButton_5->setStyleSheet("background: rgba(255,255,255,0);color: #2F42CD;");
    ui->pushButton_2->setStyleSheet("background: rgba(255,255,255,0);");
    ui->pushButton_3->setStyleSheet("background: rgba(255,255,255,0);");
    ui->pushButton_4->setStyleSheet("background: rgba(255,255,255,0);");
    ui->pushButton->setStyleSheet("background: rgba(255,255,255,0);");
    datain();
    for(int i = ui->tableWidget_2->rowCount() - 1; i >= 2; --i){
        if(ui->tableWidget_2->item(i, 4)->text().contains("无")){
            ui->tableWidget_2->removeRow(i);
        }
    }
    tab2xh();
    tabifl=5;
}

void DetectionAnalysis::tab1(){
    ui->tableWidget->setColumnCount(14);
    ui->tableWidget->setWindowTitle("QTableWidget & Item");
    ui->tableWidget->resizeColumnsToContents();
    ui->tableWidget->resizeRowsToContents();
    QStringList header;
    header<<"序号"<<"孔位"<<"样本名称"<<"样本类型"<<"荧光染料"<<"CT值"<<"样本浓度\nng/μl"<<
            "总浓度\nng/μl"<<"男性浓度\nng/μl"<<"女性浓度\nng/μl"<<"性别情况"<<"男女浓度\n比例"<<"降解指数\nDI"<<"抑制指数\nICS";
    ui->tableWidget->setHorizontalHeaderLabels(header);
    ui->tableWidget->verticalHeader()->hide();//取消行号
    ui->tableWidget->show();
}

void DetectionAnalysis::on_returnBtn_clicked()
{
    this->hide();
    emit changeToopenfileWindow();
}

// 文件数据读取
void DetectionAnalysis::datain(){
    ui->label->clear();
    ui->label_2->clear();
    ui->label_3->clear();
    QXlsx::Document xlsx(afilepath);
    QStringList sheetnames =xlsx.sheetNames();
    if (!afilepath.isEmpty()){
        if(afiletype=="7500"){
            xlsx.selectSheet("Results");
            ui->label_3->setText(" AL: R²:""暂无"" Y轴截距:""暂无"" 扩增效率:""暂无"" 斜率:""暂无");
            QPalette pe1;
            pe1.setColor(QPalette::WindowText,Qt::black);
            ui->label_3->setPalette(pe1);
            ui->label_2->setText(" AS: R²:""暂无"" Y轴截距:""暂无"" 扩增效率:""暂无"" 斜率:""暂无");
            QPalette pe2;
            pe2.setColor(QPalette::WindowText,Qt::black);
            ui->label_2->setPalette(pe2);
            ui->label->setText(" Y: R²:""暂无"" Y轴截距:""暂无"" 扩增效率:""暂无"" 斜率:""暂无");
            QPalette pe3;
            pe3.setColor(QPalette::WindowText,Qt::white);
            ui->label->setPalette(pe3);
            //            ui->label_3->setStyleSheet("color: #0600FF;}");
            //            ui->label_2->setStyleSheet("color: #00C473;");
            //            ui->label->setStyleSheet("color: #FF6000;");
            //将 Excel 中的数据存入一个 QStringList 对象中
            int k = 0;
            double JCV=0;
            for (int i = 9; i <= xlsx.dimension().rowCount(); i++) {
                QString cell_valueYG = xlsx.read(i,5).toString();
                QString cell_valueJC = xlsx.read(i,4).toString();
                double cell_valueJCV = xlsx.read(i+3,5).toDouble();
                if(cell_valueJC=="STANDARD"&&cell_valueYG=="ROX"){
                    QString BZP6 = QString::number(cell_valueJCV,'f',2);
                    double bzp6 = BZP6.toDouble();
                    JCV +=bzp6;
                    k++;
                }
            }
            double t = JCV/k;
            QStringList ybmsame;
            for (int i = 9; i <= xlsx.dimension().rowCount(); i++) {
                QString cell_value = xlsx.read(i,2).toString();
                QString cell_value2 = xlsx.read(i,4).toString();
                if(ybmsame.contains(cell_value)&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){

                }else if(!ybmsame.contains(cell_value)&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                    ybmsame.append(cell_value);
                }
            }
            QList<int> ybmnum;
            QList<double> AL;
            QList<double> AS;
            QList<double> Y;
            QList<double> CQ;
            for(int i=0;i<ybmsame.length();i++){
                ybmnum.append(0);
                AL.append(0);
                AS.append(0);
                Y.append(0);
                CQ.append(0);
            }
            for (int i = 9; i <= xlsx.dimension().rowCount(); i=i+4) {
                QString cell_value = xlsx.read(i,2).toString();
                for(int j = 0;j<ybmsame.length();j++){
                    if(cell_value==ybmsame[j]){
                        double cell_valueAL = QString::number(xlsx.read(i,10).toDouble(),'f',2).toDouble();
                        double cell_valueAS = QString::number(xlsx.read(i+1,10).toDouble(),'f',2).toDouble();
                        double cell_valueY = QString::number(xlsx.read(i+2,10).toDouble(),'f',2).toDouble();
                        double cell_valueCQ = QString::number(xlsx.read(i+3,10).toDouble(),'f',2).toDouble();
                        AL[j]+=cell_valueAL;
                        AS[j]+=cell_valueAS;
                        Y[j]+=cell_valueY;
                        CQ[j]+=cell_valueCQ;
                        ybmnum[j]++;
                    }
                }
            }
            int rowcon=xlsx.dimension().rowCount()-9;
            ui->tableWidget->setRowCount(rowcon);
            for (int i = 9; i <= xlsx.dimension().rowCount(); i++) {
                ui->tableWidget->setItem(i-9,0,new QTableWidgetItem(QString::number(i-8)));
                for (int j = 1; j <= 6; j++){
                    if(j==1){
                        QString cell_value = xlsx.read(i,j).toString();
                        ui->tableWidget->setItem(i-9,1,new QTableWidgetItem(cell_value));

                    }else if(j==2){
                        QString cell_value = xlsx.read(i,j).toString();
                        ui->tableWidget->setItem(i-9,2,new QTableWidgetItem(cell_value));

                    }else if(j==3)
                    {
                        QString cell_value = xlsx.read(i,j+1).toString();
                        ui->tableWidget->setItem(i-9,3,new QTableWidgetItem(cell_value));

                    }else if(j==4){
                        QString cell_value = xlsx.read(i,j+1).toString();
                        ui->tableWidget->setItem(i-9,4,new QTableWidgetItem(cell_value));

                    }else if(j==5){
                        QString cell_value = xlsx.read(i,j+2).toString();
                        ui->tableWidget->setItem(i-9,5,new QTableWidgetItem(QString::number(cell_value.toDouble(),'f',2)));

                    }else if(j==6){
                        QString cell_value = xlsx.read(i,j+4).toString();
                        ui->tableWidget->setItem(i-9,6,new QTableWidgetItem(QString::number(cell_value.toDouble(),'f',2)));
                    }
                }
            }
            if(true){
                int rowCount = ui->tableWidget->rowCount();
                for (int i = rowCount - 1; i >= 0; --i) {
                    // 假设我们根据某种条件来删除行
                    // 这里以第i行的某个单元格的值为例
                    QTableWidgetItem *item = ui->tableWidget->item(i, 2); // 假设我们检查第一列的值
                    if (item && item->text().isNull()) {
                        ui->tableWidget->removeRow(i);
                    }
                }
                for(int i=0;i<ui->tableWidget->rowCount();i++){
                    ui->tableWidget->setItem(i,0,new QTableWidgetItem(QString::number((i+1))));
                }
            }
            for(int i=0;i < ui->tableWidget->rowCount(); i+=4){
                for(int k = 0;k<ybmsame.length();k++){
                    QString cell_value = ui->tableWidget->item(i,2)->text();
                    QString cell_value2 = ui->tableWidget->item(i,3)->text();
                    if(cell_value==ybmsame[k]&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                        double famn = QString::number(Y[k]/ybmnum[k],'f',2).toDouble();
                        double vicn = QString::number(AS[k]/ybmnum[k],'f',2).toDouble();
                        double roxn = QString::number(AL[k]/ybmnum[k],'f',2).toDouble();
                        double cqv = QString::number(CQ[k]/ybmnum[k],'f',2).toDouble();
                        datacu(i,famn,vicn,roxn,cqv,t);
                    }
                }
                QString cell_value = ui->tableWidget->item(i,3)->text();
                if(cell_value.contains("sta",Qt::CaseInsensitive)||cell_value.contains("std",Qt::CaseInsensitive)||cell_value.contains("标准品",Qt::CaseInsensitive)){
                    ui->tableWidget->setItem(i,7,new QTableWidgetItem(ui->tableWidget->item(i+1,6)->text()));
                }
            }
            QStringList ybm;
            for(int row =0;row < ui->tableWidget->rowCount();row++){
                QString val = ui->tableWidget->item(row,2)->text();
                QString val2 = ui->tableWidget->item(row,3)->text();
                QString val3 = ui->tableWidget->item(row,4)->text();
                if(val3=="ROX"&&ybm.contains(val)&&!(val2.contains("sta",Qt::CaseInsensitive)||val2.contains("std",Qt::CaseInsensitive)||val2.contains("标准品",Qt::CaseInsensitive))){
                    for(int j = 7;j < 14;j++){
                        ui->tableWidget->setItem(row,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+1,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+2,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+3,j,new QTableWidgetItem(""));
                    }
                }else if(val3=="ROX"&&!ybm.contains(val)&&!(val2.contains("sta",Qt::CaseInsensitive)||val2.contains("std",Qt::CaseInsensitive)||val2.contains("标准品",Qt::CaseInsensitive))){
                    for(int j = 7;j < 14;j++){
                        ui->tableWidget->setItem(row+1,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+2,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+3,j,new QTableWidgetItem(""));
                    }
                    ybm.append(val);
                }
            }
            int tab2row=2;
            for(int i=0;i < ui->tableWidget->rowCount(); i+=4){
                for(int k = 0;k<ybmsame.length();k++){
                    QString cell_value = ui->tableWidget->item(i,2)->text();
                    QString cell_value2 = ui->tableWidget->item(i,3)->text();
                    QTableWidgetItem* item = ui->tableWidget->item(i, 13);
                    if(item == nullptr){
                        break;
                    }
                    if(!(item->text()=="")&&cell_value==ybmsame[k]&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                        tab2row++;
                        ui->tableWidget_2->setRowCount(tab2row);
                        ui->tableWidget_2->setItem(tab2row-1,1,new QTableWidgetItem(ui->tableWidget->item(i,1)->text()));
                        ui->tableWidget_2->setItem(tab2row-1,2,new QTableWidgetItem(ui->tableWidget->item(i,2)->text()));
                        double famn = QString::number(Y[k]/ybmnum[k],'f',2).toDouble();
                        double vicn = QString::number(AS[k]/ybmnum[k],'f',2).toDouble();
                        double roxn = QString::number(AL[k]/ybmnum[k],'f',2).toDouble();
                        dataca(tab2row-1,ui->tableWidget->item(i,13)->text().toDouble(),ui->tableWidget->item(i,12)->text().toDouble()
                               ,roxn,vicn,famn);
                    }
                }
            }
        }else if(afiletype=="7500线上"){
            xlsx.selectSheet("Standard Curve Result");
            double RRR = xlsx.read(27,27).toDouble();
            QString R1 = QString::number(RRR,'f',2);
            double RRV = xlsx.read(28,27).toDouble();
            QString V1 = QString::number(RRV,'f',2);
            double RRF = xlsx.read(29,27).toDouble();
            QString F1 = QString::number(RRF,'f',2);
            double JJR = xlsx.read(27,26).toDouble();
            QString R2 = QString::number(JJR,'f',2);
            double JJV = xlsx.read(28,27).toDouble();
            QString V2 = QString::number(JJV,'f',2);
            double JJF = xlsx.read(29,27).toDouble();
            QString F2 = QString::number(JJF,'f',2);
            double XLR = xlsx.read(27,29).toDouble();
            QString R3 = QString::number(XLR,'f',2);
            double XLV = xlsx.read(28,29).toDouble();
            QString V3 = QString::number(XLV,'f',2);
            double XLF = xlsx.read(29,29).toDouble();
            QString F3 = QString::number(XLF,'f',2);
            double XR = xlsx.read(27,28).toDouble();
            QString R4 = QString::number(XR,'f',2);
            double XV = xlsx.read(28,28).toDouble();
            QString V4 = QString::number(XV,'f',2);
            double XF = xlsx.read(29,27).toDouble();
            QString F4 = QString::number(XF,'f',2);
            if((XLR>=90&&XLR<=110)&&RRR>0.98){
                ui->label_3->setText(" AL: R²:"+R1+" Y轴截距:"+R2+" 扩增效率:"+R3+" 斜率:"+R4+"\n");
            }else{
                ui->label_3->setText(" AL: R²:"+R1+" Y轴截距:"+R2+" 扩增效率:"+R3+" 斜率:"+R4+"\n 注意！标准曲线不合格，定量结果可能不准确！");
            }
            if((XLV>=90&&XLV<=110)&&RRV>0.98){
                ui->label_2->setText(" AS: R²:"+V1+" Y轴截距:"+V2+" 扩增效率:"+V3+" 斜率:"+V4+"\n");
            }else{
                ui->label_2->setText(" AS: R²:"+V1+" Y轴截距:"+V2+" 扩增效率:"+V3+" 斜率:"+V4+"\n 注意！标准曲线不合格，定量结果可能不准确！");
            }
            if((XLF>=90&&XLF<=110)&&RRF>0.98){
                ui->label->setText(" Y: R²:"+F1+" Y轴截距:"+F2+" 扩增效率:"+F3+" 斜率:"+F4+"\n");
            }else{
                ui->label->setText(" Y: R²:"+F1+" Y轴截距:"+F2+" 扩增效率:"+F3+" 斜率:"+F4+"\n 注意！标准曲线不合格，定量结果可能不准确！");
            }
            //            ui->label_3->setStyleSheet("QLabel{background-color: rgb(255, 165, 0);}");
            //            ui->label_2->setStyleSheet("QLabel{background-color: rgb(0, 255, 0);}");
            //            ui->label->setStyleSheet("QLabel{background-color: rgb(0, 0, 139);color: rgb(255, 255, 255);}");
            //将 Excel 中的数据存入一个 QStringList 对象中
            int k = 0;
            double JCV = 0;
            for (int i = 27; i <= xlsx.dimension().rowCount(); i++) {
                QString cell_valueYG = xlsx.read(i,6).toString();
                QString cell_valueJC = xlsx.read(i,7).toString();
                double cell_valueJCV = xlsx.read(i+3,11).toDouble();
                if(cell_valueJC=="STANDARD"&&cell_valueYG=="ROX"){
                    QString BZP6 = QString::number(cell_valueJCV,'f',2);
                    double bzp6 = BZP6.toDouble();
                    JCV +=bzp6;
                    k++;
                }
            }
            double t = JCV/k;
            QStringList ybmsame;
            for (int i = 27; i <= xlsx.dimension().rowCount(); i++) {
                QString cell_value = xlsx.read(i,3).toString();
                QString cell_value2 = xlsx.read(i,7).toString();
                if(ybmsame.contains(cell_value)&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){

                }else if(!ybmsame.contains(cell_value)&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                    ybmsame.append(cell_value);
                }
            }
            QList<int> ybmnum;
            QList<double> AL;
            QList<double> AS;
            QList<double> Y;
            QList<double> CQ;
            for(int i=0;i<ybmsame.length();i++){
                ybmnum.append(0);
                AL.append(0);
                AS.append(0);
                Y.append(0);
                CQ.append(0);
            }
            for (int i = 27; i <= xlsx.dimension().rowCount(); i=i+4) {
                QString cell_value = xlsx.read(i,3).toString();
                for(int j = 0;j<ybmsame.length();j++){
                    if(cell_value==ybmsame[j]){
                        double cell_valueAL = QString::number(xlsx.read(i,4).toDouble(),'f',2).toDouble();
                        double cell_valueAS = QString::number(xlsx.read(i+1,4).toDouble(),'f',2).toDouble();
                        double cell_valueY = QString::number(xlsx.read(i+2,4).toDouble(),'f',2).toDouble();
                        double cell_valueCQ = QString::number(xlsx.read(i+3,11).toDouble(),'f',2).toDouble();
                        AL[j]+=cell_valueAL;
                        AS[j]+=cell_valueAS;
                        Y[j]+=cell_valueY;
                        CQ[j]+=cell_valueCQ;
                        ybmnum[j]++;
                    }
                }
            }
            ui->tableWidget->setRowCount(xlsx.dimension().rowCount()-27+1);
            for (int i = 27; i <= xlsx.dimension().rowCount(); i++) {
                QString row_data;
                for (int j = 1; j <= 6; j++) {
                    if(j==1){
                        QString cell_value = xlsx.read(i,2).toString();
                        ui->tableWidget->setItem(i-27,j,new QTableWidgetItem(cell_value));
                    }else if(j==2){
                        QString cell_value = xlsx.read(i,3).toString();
                        ui->tableWidget->setItem(i-27,j,new QTableWidgetItem(cell_value));
                    }else if(j==3){
                        QString cell_value = xlsx.read(i,7).toString();
                        ui->tableWidget->setItem(i-27,j,new QTableWidgetItem(cell_value));
                    }else if(j==4){
                        QString cell_value = xlsx.read(i,8).toString();
                        ui->tableWidget->setItem(i-27,j,new QTableWidgetItem(cell_value));
                    }else if(j==5){
                        double a = xlsx.read(i,11).toDouble();
                        QString cell_value = QString::number(a,'f',2);
                        ui->tableWidget->setItem(i-27,j,new QTableWidgetItem(cell_value));
                    }else if(j==6){
                        double a = xlsx.read(i,4).toDouble();
                        QString cell_value = QString::number(a,'f',2);
                        ui->tableWidget->setItem(i-27,j,new QTableWidgetItem(cell_value));
                    }
                }
            }
            for(int i=0;i<ui->tableWidget->rowCount();i++){
                ui->tableWidget->setItem(i,0,new QTableWidgetItem(QString::number((i+1))));
            }
            for(int i=0;i < ui->tableWidget->rowCount(); i+=4){
                for(int k = 0;k<ybmsame.length();k++){
                    QString cell_value = ui->tableWidget->item(i,2)->text();
                    QString cell_value2 = ui->tableWidget->item(i,3)->text();
                    if(cell_value==ybmsame[k]&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                        double famn = QString::number(Y[k]/ybmnum[k],'f',2).toDouble();
                        double vicn = QString::number(AS[k]/ybmnum[k],'f',2).toDouble();
                        double roxn = QString::number(AL[k]/ybmnum[k],'f',2).toDouble();
                        double cqv = QString::number(CQ[k]/ybmnum[k],'f',2).toDouble();
                        datacu(i,famn,vicn,roxn,cqv,t);
                    }
                }
                QString cell_value = ui->tableWidget->item(i,3)->text();
                if(cell_value.contains("sta",Qt::CaseInsensitive)||cell_value.contains("std",Qt::CaseInsensitive)||cell_value.contains("标准品",Qt::CaseInsensitive)){
                    ui->tableWidget->setItem(i,7,new QTableWidgetItem(ui->tableWidget->item(i+1,6)->text()));
                }
            }
            QStringList ybm;
            for(int row =0;row < ui->tableWidget->rowCount();row++){
                QString val = ui->tableWidget->item(row,2)->text();
                QString val2 = ui->tableWidget->item(row,3)->text();
                QString val3 = ui->tableWidget->item(row,4)->text();
                if(val3=="ROX"&&ybm.contains(val)&&!(val2.contains("sta",Qt::CaseInsensitive)||val2.contains("std",Qt::CaseInsensitive)||val2.contains("标准品",Qt::CaseInsensitive))){
                    for(int j = 7;j < 14;j++){
                        ui->tableWidget->setItem(row,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+1,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+2,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+3,j,new QTableWidgetItem(""));
                    }
                }else if(val3=="ROX"&&!ybm.contains(val)&&!(val2.contains("sta",Qt::CaseInsensitive)||val2.contains("std",Qt::CaseInsensitive)||val2.contains("标准品",Qt::CaseInsensitive))){
                    for(int j = 7;j < 14;j++){
                        ui->tableWidget->setItem(row+1,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+2,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+3,j,new QTableWidgetItem(""));
                    }
                    ybm.append(val);
                }
            }
            int tab2row=2;
            for(int i=0;i < ui->tableWidget->rowCount(); i+=4){
                for(int k = 0;k<ybmsame.length();k++){
                    QString cell_value = ui->tableWidget->item(i,2)->text();
                    QString cell_value2 = ui->tableWidget->item(i,3)->text();
                    QTableWidgetItem* item = ui->tableWidget->item(i, 13);
                    if(item == nullptr){
                        break;
                    }
                    if(!(item->text()=="")&&cell_value==ybmsame[k]&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                        tab2row++;
                        ui->tableWidget_2->setRowCount(tab2row);
                        ui->tableWidget_2->setItem(tab2row-1,1,new QTableWidgetItem(ui->tableWidget->item(i,1)->text()));
                        ui->tableWidget_2->setItem(tab2row-1,2,new QTableWidgetItem(ui->tableWidget->item(i,2)->text()));
                        double famn = QString::number(Y[k]/ybmnum[k],'f',2).toDouble();
                        double vicn = QString::number(AS[k]/ybmnum[k],'f',2).toDouble();
                        double roxn = QString::number(AL[k]/ybmnum[k],'f',2).toDouble();
                        dataca(tab2row-1,ui->tableWidget->item(i,13)->text().toDouble(),ui->tableWidget->item(i,12)->text().toDouble()
                               ,roxn,vicn,famn);
                    }
                }
            }
        }else if(afiletype=="鲲鹏"){
            xlsx.selectSheet("结果");
            int colu=1;
            for(int i=1;i<xlsx.dimension().rowCount();i++){
                QString celll = xlsx.read(i,2).toString();
                if(celll=="孔"){
                    colu = i;
                    break;
                }
            }
            double RRR = xlsx.read(colu+1,10).toDouble();
            QString R1 = QString::number(RRR,'f',2);
            double RRV = xlsx.read(colu+2,10).toDouble();
            QString V1 = QString::number(RRV,'f',2);
            double RRF = xlsx.read(colu+3,10).toDouble();
            QString F1 = QString::number(RRF,'f',2);
            double JJR = xlsx.read(colu+1,11).toDouble();
            QString R2 = QString::number(JJR,'f',2);
            double JJV = xlsx.read(colu+2,11).toDouble();
            QString V2 = QString::number(JJV,'f',2);
            double JJF = xlsx.read(colu+3,11).toDouble();
            QString F2 = QString::number(JJF,'f',2);
            double XLR = xlsx.read(colu+1,12).toDouble();
            QString R3 = QString::number(XLR,'f',2);
            double XLV = xlsx.read(colu+1,12).toDouble();
            QString V3 = QString::number(XLV,'f',2);
            double XLF = xlsx.read(colu+1,12).toDouble();
            QString F3 = QString::number(XLF,'f',2);
            double XR = xlsx.read(colu+1,13).toDouble();
            QString R4 = QString::number(XR,'f',2);
            double XV = xlsx.read(colu+1,13).toDouble();
            QString V4 = QString::number(XV,'f',2);
            double XF = xlsx.read(colu+1,13).toDouble();
            QString F4 = QString::number(XF,'f',2);
            if((XLR>=90&&XLR<=110)&&RRR>0.98){
                ui->label_3->setText(" AL: R²:"+R1+" Y轴截距:"+R2+" 扩增效率:"+R3+" 斜率:"+R4+"\n");
            }else{
                ui->label_3->setText(" AL: R²:"+R1+" Y轴截距:"+R2+" 扩增效率:"+R3+" 斜率:"+R4+"\n 注意！标准曲线不合格，定量结果可能不准确！");
            }
            if((XLV>=90&&XLV<=110)&&RRV>0.98){
                ui->label_2->setText(" AS: R²:"+V1+" Y轴截距:"+V2+" 扩增效率:"+V3+" 斜率:"+V4+"\n");
            }else{
                ui->label_2->setText(" AS: R²:"+V1+" Y轴截距:"+V2+" 扩增效率:"+V3+" 斜率:"+V4+"\n 注意！标准曲线不合格，定量结果可能不准确！");
            }
            if((XLF>=90&&XLF<=110)&&RRF>0.98){
                ui->label->setText(" Y: R²:"+F1+" Y轴截距:"+F2+" 扩增效率:"+F3+" 斜率:"+F4+"\n");
            }else{
                ui->label->setText(" Y: R²:"+F1+" Y轴截距:"+F2+" 扩增效率:"+F3+" 斜率:"+F4+"\n 注意！标准曲线不合格，定量结果可能不准确！");
            }
            //            ui->label_3->setStyleSheet("QLabel{background-color: rgb(255, 165, 0);}");
            //            ui->label_2->setStyleSheet("QLabel{background-color: rgb(0, 255, 0);}");
            //            ui->label->setStyleSheet("QLabel{background-color: rgb(0, 0, 139);color: rgb(255, 255, 255);}");
            //将 Excel 中的数据存入一个 QStringList 对象中
            int k = 0;
            double JCV = 0;
            qDebug()<<xlsx.dimension().rowCount();
            for(int i=colu+1;i<xlsx.dimension().rowCount();i++){
                QString cell_valueBZE = xlsx.read(i,5).toString();
                if(cell_valueBZE=="标准品"){
                    for(int j=i;j<i+4;j++){
                        QString cell_valueYE = xlsx.read(j,6).toString();
                        bzend.append(cell_valueYE);
                    }
                    break;
                }
            }
            qDebug()<<bzend;
            for(int i=colu+1;i<xlsx.dimension().rowCount();i++){
                QString cell_valueBZE = xlsx.read(i,5).toString();
                if(cell_valueBZE=="未知样品"){
                    for(int j=i;j<i+4;j++){
                        QString cell_valueYE = xlsx.read(j,6).toString();
                        fbzend.append(cell_valueYE);
                    }
                    break;
                }
            }
            qDebug()<<fbzend;
            vaend.append("ROX");
            vaend.append("VIC");
            vaend.append("FAM");
            vaend.append("CY5");
            for (int i = 0; i < 4; ++i) {
                for(int j = 0; j < 4; j++){
                    if ( vaend[i]==bzend.at(j) ) {
                        bzed.append(j);
                    }
                }
            }
            for (int i = 0; i < 4; ++i) {
                for(int j = 0; j < 4; j++){
                    if ( vaend[i]== fbzend.at(j)) {
                        fbzed.append(j);
                    }
                }
            }
            qDebug()<<bzend<<fbzend;
            qDebug()<<bzed<<fbzed;
            for (int i = colu+1; i <= xlsx.dimension().rowCount(); i++) {
                QString cell_valueYG = xlsx.read(i,6).toString();
                QString cell_valueJC = xlsx.read(i,5).toString();
                if(cell_valueJC=="标准品"&&cell_valueYG=="ROX"){
                    double cell_valueJCV = xlsx.read(i+bzed[3]-bzed[0], 7).toDouble();
                    QString BZP6 = QString::number(cell_valueJCV,'f',4);
                    double bzp6 = BZP6.toDouble();
                    JCV +=bzp6;
                    k++;
                }
            }

            double t = JCV/k;
            QStringList ybmsame;
            for (int i = colu+1; i <= xlsx.dimension().rowCount(); i++) {
                QString cell_value = xlsx.read(i, 3).toString();
                QString cell_value2 =  xlsx.read(i, 5).toString();
                if(ybmsame.contains(cell_value)&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){

                }else if(!ybmsame.contains(cell_value)&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                    ybmsame.append(cell_value);
                }
            }
            QList<int> ybmnum;
            QList<double> AL;
            QList<double> AS;
            QList<double> Y;
            QList<double> CQ;
            for(int i=0;i<ybmsame.length();i++){
                ybmnum.append(0);
                AL.append(0);
                AS.append(0);
                Y.append(0);
                CQ.append(0);
            }
            for (int i = colu+1+fbzed[0]; i <= xlsx.dimension().rowCount(); i=i+4) {
                QString cell_value = xlsx.read(i,3).toString();
                for(int j = 0;j<ybmsame.length();j++){
                    if(cell_value==ybmsame[j]){
                        double cell_valueAL = QString::number(xlsx.read(i,14).toDouble(),'f',2).toDouble();
                        double cell_valueAS = QString::number(xlsx.read(i+fbzed[1]-fbzed[0],14).toDouble(),'f',2).toDouble();
                        double cell_valueY = QString::number(xlsx.read(i+fbzed[2]-fbzed[0],14).toDouble(),'f',2).toDouble();
                        double cell_valueCQ = QString::number(xlsx.read(i+fbzed[3]-fbzed[0],7).toDouble(),'f',2).toDouble();
                        AL[j]+=cell_valueAL;
                        AS[j]+=cell_valueAS;
                        Y[j]+=cell_valueY;
                        CQ[j]+=cell_valueCQ;
                        ybmnum[j]++;
                    }
                }
            }
            qDebug()<<fbzed[3]-fbzed[0]<<t<<CQ;
            ui->tableWidget->setRowCount(xlsx.dimension().rowCount()-colu);
            for (int i = colu+1; i <= xlsx.dimension().rowCount(); i++) {
                for (int j = 1; j <= 6; j++) {
                    if(j==1){
                        QString cell_value = xlsx.read(i,2).toString();
                        ui->tableWidget->setItem(i-colu-1,j,new QTableWidgetItem(cell_value));
                    }else if(j==2){
                        QString cell_value = xlsx.read(i,3).toString();
                        ui->tableWidget->setItem(i-colu-1,j,new QTableWidgetItem(cell_value));
                    }else if(j==3){
                        QString cell_value = xlsx.read(i,5).toString();
                        ui->tableWidget->setItem(i-colu-1,j,new QTableWidgetItem(cell_value));
                    }else if(j==4){
                        QString cell_value = xlsx.read(i,6).toString();
                        ui->tableWidget->setItem(i-colu-1,j,new QTableWidgetItem(cell_value));
                    }else if(j==5){
                        double a = xlsx.read(i,7).toDouble();
                        QString cell_value = QString::number(a,'f',2);
                        ui->tableWidget->setItem(i-colu-1,j,new QTableWidgetItem(cell_value));
                    }else if(j==6){
                        double a = xlsx.read(i,14).toDouble();
                        QString cell_value = QString::number(a,'f',2);
                        ui->tableWidget->setItem(i-colu-1,j,new QTableWidgetItem(cell_value));
                    }
                }
            }
            for(int i=0;i<ui->tableWidget->rowCount();i++){
                ui->tableWidget->setItem(i,0,new QTableWidgetItem(QString::number((i+1))));
            }
            for(int i=0;i < ui->tableWidget->rowCount(); i+=4){
                for(int k = 0;k<ybmsame.length();k++){
                    QString cell_value = ui->tableWidget->item(i,2)->text();
                    QString cell_value2 = ui->tableWidget->item(i,3)->text();
                    if(cell_value==ybmsame[k]&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                        double famn = QString::number(Y[k]/ybmnum[k],'f',2).toDouble();
                        double vicn = QString::number(AS[k]/ybmnum[k],'f',2).toDouble();
                        double roxn = QString::number(AL[k]/ybmnum[k],'f',2).toDouble();
                        double cqv = QString::number(CQ[k]/ybmnum[k],'f',2).toDouble();
                        datacu(i,famn,vicn,roxn,cqv,t);
                    }
                }
                QString cell_value = ui->tableWidget->item(i,3)->text();
                if(cell_value.contains("sta",Qt::CaseInsensitive)||cell_value.contains("std",Qt::CaseInsensitive)||cell_value.contains("标准品",Qt::CaseInsensitive)){
                    ui->tableWidget->setItem(i,7,new QTableWidgetItem(ui->tableWidget->item(i+1,6)->text()));
                }
            }
            QStringList ybm;
            for(int row =0;row < ui->tableWidget->rowCount();row+=4){
                QString val = ui->tableWidget->item(row,2)->text();
                QString val2 = ui->tableWidget->item(row,3)->text();
                QString val3 = ui->tableWidget->item(row,4)->text();
                if(ybm.contains(val)&&!(val2.contains("sta",Qt::CaseInsensitive)||val2.contains("std",Qt::CaseInsensitive)||val2.contains("标准品",Qt::CaseInsensitive))){
                    for(int j = 7;j < 14;j++){
                        //                        ui->tableWidget->setItem(row,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+bzed[1]-bzed[0],j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+bzed[2]-bzed[0],j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+bzed[3]-bzed[0],j,new QTableWidgetItem(""));
                    }
                }else if(!ybm.contains(val)&&!(val2.contains("sta",Qt::CaseInsensitive)||val2.contains("std",Qt::CaseInsensitive)||val2.contains("标准品",Qt::CaseInsensitive))){
                    for(int j = 7;j < 14;j++){
                        ui->tableWidget->setItem(row+bzed[1]-bzed[0],j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+bzed[2]-bzed[0],j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+bzed[3]-bzed[0],j,new QTableWidgetItem(""));
                    }
                    ybm.append(val);
                }
                qDebug()<<row;
            }
            int tab2row=2;
            for(int i=0;i < ui->tableWidget->rowCount(); i+=4){
                for(int k = 0;k<ybmsame.length();k++){
                    QString cell_value = ui->tableWidget->item(i,2)->text();
                    QString cell_value2 = ui->tableWidget->item(i,3)->text();
                    QTableWidgetItem* item = ui->tableWidget->item(i, 13);
                    if(item == nullptr){
                        break;
                    }
                    if(!(item->text()=="")&&cell_value==ybmsame[k]&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                        tab2row++;
                        ui->tableWidget_2->setRowCount(tab2row);
                        ui->tableWidget_2->setItem(tab2row-1,1,new QTableWidgetItem(ui->tableWidget->item(i,1)->text()));
                        ui->tableWidget_2->setItem(tab2row-1,2,new QTableWidgetItem(ui->tableWidget->item(i,2)->text()));
                        double famn = QString::number(Y[k]/ybmnum[k],'f',2).toDouble();
                        double vicn = QString::number(AS[k]/ybmnum[k],'f',2).toDouble();
                        double roxn = QString::number(AL[k]/ybmnum[k],'f',2).toDouble();
                        dataca(tab2row-1,ui->tableWidget->item(i,13)->text().toDouble(),ui->tableWidget->item(i,12)->text().toDouble()
                               ,roxn,vicn,famn);
                    }
                }
            }
        }else if(afiletype=="Q5"){
            xlsx.selectSheet("结果分析");
            for(int i=48;i<xlsx.dimension().rowCount();i++){
                QString cell_valueBZE = xlsx.read(i,6).toString();
                if(cell_valueBZE=="STANDARD"){
                    for(int j=i;j<i+4;j++){
                        QString cell_valueYE = xlsx.read(j,7).toString();
                        bzend.append(cell_valueYE);
                    }
                    break;
                }
            }
            for(int i=48;i<xlsx.dimension().rowCount();i++){
                QString cell_valueBZE = xlsx.read(i,6).toString();
                if(cell_valueBZE=="UNKNOWN"){
                    for(int j=i;j<i+4;j++){
                        QString cell_valueYE = xlsx.read(j,7).toString();
                        fbzend.append(cell_valueYE);
                    }
                    break;
                }
            }
            vaend.append("ROX");
            vaend.append("VIC");
            vaend.append("FAM");
            vaend.append("CY5");
            for (int i = 0; i < 4; ++i) {
                for(int j = 0; j < 4; j++){
                    if ( vaend[i]==bzend.at(j) ) {
                        bzed.append(j);
                    }
                }
            }
            for (int i = 0; i < 4; ++i) {
                for(int j = 0; j < 4; j++){
                    if ( vaend[i]== fbzend.at(j)) {
                        fbzed.append(j);
                    }
                }
            }
            double RRR = xlsx.read(48+bzed[0], 16).toDouble();
            QString R1 = QString::number(RRR,'f',4);
            double RRV = xlsx.read(48+bzed[1], 16).toDouble();
            QString V1 = QString::number(RRV,'f',4);
            double RRF = xlsx.read(48+bzed[2], 16).toDouble();
            QString F1 = QString::number(RRF,'f',4);
            double JJR = xlsx.read(48+bzed[0], 15).toDouble();
            QString R2 = QString::number(JJR,'f',4);
            double JJV = xlsx.read(48+bzed[1], 15).toDouble();
            QString V2 = QString::number(JJV,'f',4);
            double JJF = xlsx.read(48+bzed[2], 15).toDouble();
            QString F2 = QString::number(JJF,'f',4);
            double XLR = xlsx.read(48+bzed[0], 18).toDouble();
            QString R3 = QString::number(XLR,'f',4);
            double XLV = xlsx.read(48+bzed[1], 18).toDouble();
            QString V3 = QString::number(XLV,'f',4);
            double XLF = xlsx.read(48+bzed[2], 18).toDouble();
            QString F3 = QString::number(XLF,'f',4);
            double XR = xlsx.read(48+bzed[0], 17).toDouble();
            QString R4 = QString::number(XR,'f',4);
            double XV = xlsx.read(48+bzed[1], 17).toDouble();
            QString V4 = QString::number(XV,'f',4);
            double XF = xlsx.read(48+bzed[2], 17).toDouble();
            QString F4 = QString::number(XF,'f',4);
            if((XLR>=90&&XLR<=110)&&RRR>0.98){
                ui->label_3->setText(" AL: R²:"+R1+" Y轴截距:"+R2+" 扩增效率:"+R3+" 斜率:"+R4+"\n");
            }else{
                ui->label_3->setText(" AL: R²:"+R1+" Y轴截距:"+R2+" 扩增效率:"+R3+" 斜率:"+R4+"\n 注意！标准曲线不合格，定量结果可能不准确！");
            }
            if((XLV>=90&&XLV<=110)&&RRV>0.98){
                ui->label_2->setText(" AS: R²:"+V1+" Y轴截距:"+V2+" 扩增效率:"+V3+" 斜率:"+V4+"\n");
            }else{
                ui->label_2->setText(" AS: R²:"+V1+" Y轴截距:"+V2+" 扩增效率:"+V3+" 斜率:"+V4+"\n 注意！标准曲线不合格，定量结果可能不准确！");
            }
            if((XLF>=90&&XLF<=110)&&RRF>0.98){
                ui->label->setText(" Y: R²:"+F1+" Y轴截距:"+F2+" 扩增效率:"+F3+" 斜率:"+F4+"\n");
            }else{
                ui->label->setText(" Y: R²:"+F1+" Y轴截距:"+F2+" 扩增效率:"+F3+" 斜率:"+F4+"\n 注意！标准曲线不合格，定量结果可能不准确！");
            }
            //            ui->label_3->setStyleSheet("QLabel{background-color: rgb(255, 165, 0);}");
            //            ui->label_2->setStyleSheet("QLabel{background-color: rgb(0, 255, 0);}");
            //            ui->label->setStyleSheet("QLabel{background-color: rgb(0, 0, 139);}");
            //将 Excel 中的数据存入一个 QStringList 对象中
            QString cell_valueQ5FL = xlsx.read(50, 17).toString();
            if(cell_valueQ5FL=="ROX"){
                q5fl=1;
            }else{
                q5fl=0;
            }
            int k = 0;
            double JCV = 0;
            for (int i = 48; i <= xlsx.dimension().rowCount(); i++) {
                QString cell_valueYG = xlsx.read(i, 7).toString();
                QString cell_valueJC = xlsx.read(i, 6).toString();
                double cell_valueJCV;
                if(q5fl==1){
                    cell_valueJCV = xlsx.read(i-2, 9).toDouble();
                }else if(q5fl==0){
                    cell_valueJCV = xlsx.read(i+3, 9).toDouble();
                }
                if(cell_valueJC=="STANDARD"&&cell_valueYG=="ROX"){
                    QString BZP6 = QString::number(cell_valueJCV,'f',4);
                    double bzp6 = BZP6.toDouble();
                    JCV +=bzp6;
                    k++;
                }
            }
            double t = JCV/k;
            QStringList ybmsame;
            for (int i = 48; i <= xlsx.dimension().rowCount(); i++) {
                QString cell_value = xlsx.read(i, 4).toString();
                QString cell_value2 = xlsx.read(i, 6).toString();
                if(ybmsame.contains(cell_value)&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){

                }else if(!ybmsame.contains(cell_value)&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                    ybmsame.append(cell_value);
                }
            }
            QList<int> ybmnum;
            QList<double> AL;
            QList<double> AS;
            QList<double> Y;
            QList<double> CQ;
            for(int i=0;i<ybmsame.length();i++){
                ybmnum.append(0);
                AL.append(0);
                AS.append(0);
                Y.append(0);
                CQ.append(0);
            }
            int Q5I=0;
            if(q5fl==1){
                Q5I=50;
            }else if(q5fl==0){
                Q5I=48;
            }
            for (int i = 48+fbzed[0]; i <= xlsx.dimension().rowCount(); i=i+4) {
                QString cell_value = xlsx.read(i, 4).toString();
                for(int j = 0;j<ybmsame.length();j++){
                    if(cell_value==ybmsame[j]){
                        double cell_valueAL = QString::number(xlsx.read(i, 12).toDouble(),'f',4).toDouble();
                        double cell_valueAS = QString::number(xlsx.read(i+fbzed[1]-fbzed[0], 12).toDouble(),'f',4).toDouble();
                        double cell_valueY = QString::number(xlsx.read(i+fbzed[2]-fbzed[0], 12).toDouble(),'f',4).toDouble();
                        double cell_valueCQ = QString::number(xlsx.read(i+fbzed[3]-fbzed[0], 9).toDouble(),'f',4).toDouble();
                        AL[j]+=cell_valueAL;
                        AS[j]+=cell_valueAS;
                        Y[j]+=cell_valueY;
                        CQ[j]+=cell_valueCQ;
                        ybmnum[j]++;
                    }
                }
            }
            ui->tableWidget->setRowCount(xlsx.dimension().rowCount()-48+1);
            for (int i = 48; i <= xlsx.dimension().rowCount(); i++) {
                for (int j = 1; j <= 6; j++) {
                    if(j==1){
                        QString cell_value = xlsx.read(i,2).toString();
                        ui->tableWidget->setItem(i-48,j,new QTableWidgetItem(cell_value));
                    }else if(j==2){
                        QString cell_value = xlsx.read(i,4).toString();
                        ui->tableWidget->setItem(i-48,j,new QTableWidgetItem(cell_value));
                    }else if(j==3){
                        QString cell_value = xlsx.read(i,6).toString();
                        ui->tableWidget->setItem(i-48,j,new QTableWidgetItem(cell_value));
                    }else if(j==4){
                        QString cell_value = xlsx.read(i,7).toString();
                        ui->tableWidget->setItem(i-48,j,new QTableWidgetItem(cell_value));
                    }else if(j==5){
                        double a = xlsx.read(i,9).toDouble();
                        QString cell_value = QString::number(a,'f',2);
                        ui->tableWidget->setItem(i-48,j,new QTableWidgetItem(cell_value));
                    }else if(j==6){
                        double a = xlsx.read(i,12).toDouble();
                        QString cell_value = QString::number(a,'f',2);
                        ui->tableWidget->setItem(i-48,j,new QTableWidgetItem(cell_value));
                    }
                }
            }
            for(int i=0;i<ui->tableWidget->rowCount();i++){
                ui->tableWidget->setItem(i,0,new QTableWidgetItem(QString::number((i+1))));
            }
            for(int i=0;i < ui->tableWidget->rowCount(); i+=4){
                for(int k = 0;k<ybmsame.length();k++){
                    QString cell_value = ui->tableWidget->item(i,2)->text();
                    QString cell_value2 = ui->tableWidget->item(i,3)->text();
                    if(cell_value==ybmsame[k]&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                        double famn = QString::number(Y[k]/ybmnum[k],'f',2).toDouble();
                        double vicn = QString::number(AS[k]/ybmnum[k],'f',2).toDouble();
                        double roxn = QString::number(AL[k]/ybmnum[k],'f',2).toDouble();
                        double cqv = QString::number(CQ[k]/ybmnum[k],'f',2).toDouble();
                        datacu(i,famn,vicn,roxn,cqv,t);
                    }
                }
                QString cell_value = ui->tableWidget->item(i,3)->text();
                if(cell_value.contains("sta",Qt::CaseInsensitive)||cell_value.contains("std",Qt::CaseInsensitive)||cell_value.contains("标准品",Qt::CaseInsensitive)){
                    ui->tableWidget->setItem(i,7,new QTableWidgetItem(ui->tableWidget->item(i+1,6)->text()));
                }
            }
            QStringList ybm;
            for(int row =0;row < ui->tableWidget->rowCount();row++){
                QString val = ui->tableWidget->item(row,2)->text();
                QString val2 = ui->tableWidget->item(row,3)->text();
                QString val3 = ui->tableWidget->item(row,4)->text();
                if(val3=="ROX"&&ybm.contains(val)&&!(val2.contains("sta",Qt::CaseInsensitive)||val2.contains("std",Qt::CaseInsensitive)||val2.contains("标准品",Qt::CaseInsensitive))){
                    for(int j = 7;j < 14;j++){
                        ui->tableWidget->setItem(row,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+bzed[1]-bzed[0],j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+bzed[2]-bzed[0],j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+bzed[3]-bzed[0],j,new QTableWidgetItem(""));
                    }
                }else if(val3=="ROX"&&!ybm.contains(val)&&!(val2.contains("sta",Qt::CaseInsensitive)||val2.contains("std",Qt::CaseInsensitive)||val2.contains("标准品",Qt::CaseInsensitive))){
                    for(int j = 7;j < 14;j++){
                        ui->tableWidget->setItem(row+bzed[1]-bzed[0],j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+bzed[2]-bzed[0],j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+bzed[3]-bzed[0],j,new QTableWidgetItem(""));
                    }
                    ybm.append(val);
                }
            }
            int tab2row=2;
            for(int i=0;i < ui->tableWidget->rowCount(); i+=4){
                for(int k = 0;k<ybmsame.length();k++){
                    QString cell_value = ui->tableWidget->item(i,2)->text();
                    QString cell_value2 = ui->tableWidget->item(i,3)->text();
                    QTableWidgetItem* item = ui->tableWidget->item(i, 13);
                    if(item == nullptr){
                        break;
                    }
                    if(!(item->text()=="")&&cell_value==ybmsame[k]&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                        tab2row++;
                        ui->tableWidget_2->setRowCount(tab2row);
                        ui->tableWidget_2->setItem(tab2row-1,1,new QTableWidgetItem(ui->tableWidget->item(i,1)->text()));
                        ui->tableWidget_2->setItem(tab2row-1,2,new QTableWidgetItem(ui->tableWidget->item(i,2)->text()));
                        double famn = QString::number(Y[k]/ybmnum[k],'f',2).toDouble();
                        double vicn = QString::number(AS[k]/ybmnum[k],'f',2).toDouble();
                        double roxn = QString::number(AL[k]/ybmnum[k],'f',2).toDouble();
                        dataca(tab2row-1,ui->tableWidget->item(i,13)->text().toDouble(),ui->tableWidget->item(i,12)->text().toDouble()
                               ,roxn,vicn,famn);
                    }
                }
            }
        }else if(afiletype=="Q5英文版"){
            xlsx.selectSheet("Results");
            for(int i=48;i<xlsx.dimension().rowCount();i++){
                QString cell_valueBZE = xlsx.read(i,6).toString();
                if(cell_valueBZE=="STANDARD"){
                    for(int j=i;j<i+4;j++){
                        QString cell_valueYE = xlsx.read(j,7).toString();
                        bzend.append(cell_valueYE);
                    }
                    break;
                }
            }
            for(int i=48;i<xlsx.dimension().rowCount();i++){
                QString cell_valueBZE = xlsx.read(i,6).toString();
                if(cell_valueBZE=="UNKNOWN"){
                    for(int j=i;j<i+4;j++){
                        QString cell_valueYE = xlsx.read(j,7).toString();
                        fbzend.append(cell_valueYE);
                    }
                    break;
                }
            }
            vaend.append("ROX");
            vaend.append("VIC");
            vaend.append("FAM");
            vaend.append("CY5");
            for (int i = 0; i < 4; ++i) {
                for(int j = 0; j < 4; j++){
                    if ( vaend[i]==bzend.at(j) ) {
                        bzed.append(j);
                    }
                }
            }
            for (int i = 0; i < 4; ++i) {
                for(int j = 0; j < 4; j++){
                    if ( vaend[i]== fbzend.at(j)) {
                        fbzed.append(j);
                    }
                }
            }
            double RRR = xlsx.read(48+bzed[0], 16).toDouble();
            QString R1 = QString::number(RRR,'f',4);
            double RRV = xlsx.read(48+bzed[1], 16).toDouble();
            QString V1 = QString::number(RRV,'f',4);
            double RRF = xlsx.read(48+bzed[2], 16).toDouble();
            QString F1 = QString::number(RRF,'f',4);
            double JJR = xlsx.read(48+bzed[0], 15).toDouble();
            QString R2 = QString::number(JJR,'f',4);
            double JJV = xlsx.read(48+bzed[1], 15).toDouble();
            QString V2 = QString::number(JJV,'f',4);
            double JJF = xlsx.read(48+bzed[2], 15).toDouble();
            QString F2 = QString::number(JJF,'f',4);
            double XLR = xlsx.read(48+bzed[0], 18).toDouble();
            QString R3 = QString::number(XLR,'f',4);
            double XLV = xlsx.read(48+bzed[1], 18).toDouble();
            QString V3 = QString::number(XLV,'f',4);
            double XLF = xlsx.read(48+bzed[2], 18).toDouble();
            QString F3 = QString::number(XLF,'f',4);
            double XR = xlsx.read(48+bzed[0], 17).toDouble();
            QString R4 = QString::number(XR,'f',4);
            double XV = xlsx.read(48+bzed[1], 17).toDouble();
            QString V4 = QString::number(XV,'f',4);
            double XF = xlsx.read(48+bzed[2], 17).toDouble();
            QString F4 = QString::number(XF,'f',4);
            if((XLR>=90&&XLR<=110)&&RRR>0.98){
                ui->label_3->setText(" AL: R²:"+R1+" Y轴截距:"+R2+" 扩增效率:"+R3+" 斜率:"+R4+"\n");
            }else{
                ui->label_3->setText(" AL: R²:"+R1+" Y轴截距:"+R2+" 扩增效率:"+R3+" 斜率:"+R4+"\n 注意！标准曲线不合格，定量结果可能不准确！");
            }
            if((XLV>=90&&XLV<=110)&&RRV>0.98){
                ui->label_2->setText(" AS: R²:"+V1+" Y轴截距:"+V2+" 扩增效率:"+V3+" 斜率:"+V4+"\n");
            }else{
                ui->label_2->setText(" AS: R²:"+V1+" Y轴截距:"+V2+" 扩增效率:"+V3+" 斜率:"+V4+"\n 注意！标准曲线不合格，定量结果可能不准确！");
            }
            if((XLF>=90&&XLF<=110)&&RRF>0.98){
                ui->label->setText(" Y: R²:"+F1+" Y轴截距:"+F2+" 扩增效率:"+F3+" 斜率:"+F4+"\n");
            }else{
                ui->label->setText(" Y: R²:"+F1+" Y轴截距:"+F2+" 扩增效率:"+F3+" 斜率:"+F4+"\n 注意！标准曲线不合格，定量结果可能不准确！");
            }
            //            ui->label_3->setStyleSheet("QLabel{background-color: rgb(255, 165, 0);}");
            //            ui->label_2->setStyleSheet("QLabel{background-color: rgb(0, 255, 0);}");
            //            ui->label->setStyleSheet("QLabel{background-color: rgb(0, 0, 139);}");
            //将 Excel 中的数据存入一个 QStringList 对象中
            QString cell_valueQ5FL = xlsx.read(50, 17).toString();
            if(cell_valueQ5FL=="ROX"){
                q5fl=1;
            }else{
                q5fl=0;
            }
            int k = 0;
            double JCV = 0;
            for (int i = 48; i <= xlsx.dimension().rowCount(); i++) {
                QString cell_valueYG = xlsx.read(i, 7).toString();
                QString cell_valueJC = xlsx.read(i, 6).toString();
                double cell_valueJCV;
                if(q5fl==1){
                    cell_valueJCV = xlsx.read(i-2, 9).toDouble();
                }else if(q5fl==0){
                    cell_valueJCV = xlsx.read(i+3, 9).toDouble();
                }
                if(cell_valueJC=="STANDARD"&&cell_valueYG=="ROX"){
                    QString BZP6 = QString::number(cell_valueJCV,'f',4);
                    double bzp6 = BZP6.toDouble();
                    JCV +=bzp6;
                    k++;
                }
            }
            double t = JCV/k;
            QStringList ybmsame;
            for (int i = 48; i <= xlsx.dimension().rowCount(); i++) {
                QString cell_value = xlsx.read(i, 4).toString();
                QString cell_value2 = xlsx.read(i, 6).toString();
                if(ybmsame.contains(cell_value)&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){

                }else if(!ybmsame.contains(cell_value)&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                    ybmsame.append(cell_value);
                }
            }
            QList<int> ybmnum;
            QList<double> AL;
            QList<double> AS;
            QList<double> Y;
            QList<double> CQ;
            for(int i=0;i<ybmsame.length();i++){
                ybmnum.append(0);
                AL.append(0);
                AS.append(0);
                Y.append(0);
                CQ.append(0);
            }
            int Q5I=0;
            if(q5fl==1){
                Q5I=50;
            }else if(q5fl==0){
                Q5I=48;
            }
            for (int i = 48+fbzed[0]; i <= xlsx.dimension().rowCount(); i=i+4) {
                QString cell_value = xlsx.read(i, 4).toString();
                for(int j = 0;j<ybmsame.length();j++){
                    if(cell_value==ybmsame[j]){
                        double cell_valueAL = QString::number(xlsx.read(i, 12).toDouble(),'f',4).toDouble();
                        double cell_valueAS = QString::number(xlsx.read(i+fbzed[1]-fbzed[0], 12).toDouble(),'f',4).toDouble();
                        double cell_valueY = QString::number(xlsx.read(i+fbzed[2]-fbzed[0], 12).toDouble(),'f',4).toDouble();
                        double cell_valueCQ = QString::number(xlsx.read(i+fbzed[3]-fbzed[0], 9).toDouble(),'f',4).toDouble();
                        AL[j]+=cell_valueAL;
                        AS[j]+=cell_valueAS;
                        Y[j]+=cell_valueY;
                        CQ[j]+=cell_valueCQ;
                        ybmnum[j]++;
                    }
                }
            }
            ui->tableWidget->setRowCount(xlsx.dimension().rowCount()-48+1);
            for (int i = 48; i <= xlsx.dimension().rowCount(); i++) {
                for (int j = 1; j <= 6; j++) {
                    if(j==1){
                        QString cell_value = xlsx.read(i,2).toString();
                        ui->tableWidget->setItem(i-48,j,new QTableWidgetItem(cell_value));
                    }else if(j==2){
                        QString cell_value = xlsx.read(i,4).toString();
                        ui->tableWidget->setItem(i-48,j,new QTableWidgetItem(cell_value));
                    }else if(j==3){
                        QString cell_value = xlsx.read(i,6).toString();
                        ui->tableWidget->setItem(i-48,j,new QTableWidgetItem(cell_value));
                    }else if(j==4){
                        QString cell_value = xlsx.read(i,7).toString();
                        ui->tableWidget->setItem(i-48,j,new QTableWidgetItem(cell_value));
                    }else if(j==5){
                        double a = xlsx.read(i,9).toDouble();
                        QString cell_value = QString::number(a,'f',2);
                        ui->tableWidget->setItem(i-48,j,new QTableWidgetItem(cell_value));
                    }else if(j==6){
                        double a = xlsx.read(i,12).toDouble();
                        QString cell_value = QString::number(a,'f',2);
                        ui->tableWidget->setItem(i-48,j,new QTableWidgetItem(cell_value));
                    }
                }
            }
            for(int i=0;i<ui->tableWidget->rowCount();i++){
                ui->tableWidget->setItem(i,0,new QTableWidgetItem(QString::number((i+1))));
            }
            for(int i=0;i < ui->tableWidget->rowCount(); i+=4){
                for(int k = 0;k<ybmsame.length();k++){
                    QString cell_value = ui->tableWidget->item(i,2)->text();
                    QString cell_value2 = ui->tableWidget->item(i,3)->text();
                    if(cell_value==ybmsame[k]&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                        double famn = QString::number(Y[k]/ybmnum[k],'f',2).toDouble();
                        double vicn = QString::number(AS[k]/ybmnum[k],'f',2).toDouble();
                        double roxn = QString::number(AL[k]/ybmnum[k],'f',2).toDouble();
                        double cqv = QString::number(CQ[k]/ybmnum[k],'f',2).toDouble();
                        datacu(i,famn,vicn,roxn,cqv,t);
                    }
                }
                QString cell_value = ui->tableWidget->item(i,3)->text();
                if(cell_value.contains("sta",Qt::CaseInsensitive)||cell_value.contains("std",Qt::CaseInsensitive)||cell_value.contains("标准品",Qt::CaseInsensitive)){
                    ui->tableWidget->setItem(i,7,new QTableWidgetItem(ui->tableWidget->item(i+1,6)->text()));
                }
            }
            QStringList ybm;
            for(int row =0;row < ui->tableWidget->rowCount();row++){
                QString val = ui->tableWidget->item(row,2)->text();
                QString val2 = ui->tableWidget->item(row,3)->text();
                QString val3 = ui->tableWidget->item(row,4)->text();
                if(val3=="ROX"&&ybm.contains(val)&&!(val2.contains("sta",Qt::CaseInsensitive)||val2.contains("std",Qt::CaseInsensitive)||val2.contains("标准品",Qt::CaseInsensitive))){
                    for(int j = 7;j < 14;j++){
                        ui->tableWidget->setItem(row,j,new QTableWidgetItem(" "));
                        ui->tableWidget->setItem(row+bzed[1]-bzed[0],j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+bzed[2]-bzed[0],j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+bzed[3]-bzed[0],j,new QTableWidgetItem(""));
                    }
                }else if(val3=="ROX"&&!ybm.contains(val)&&!(val2.contains("sta",Qt::CaseInsensitive)||val2.contains("std",Qt::CaseInsensitive)||val2.contains("标准品",Qt::CaseInsensitive))){
                    for(int j = 7;j < 14;j++){
                        ui->tableWidget->setItem(row+bzed[1]-bzed[0],j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+bzed[2]-bzed[0],j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+bzed[3]-bzed[0],j,new QTableWidgetItem(""));
                    }
                    ybm.append(val);
                }
            }
            int tab2row=2;
            for(int i=0;i < ui->tableWidget->rowCount(); i+=4){
                for(int k = 0;k<ybmsame.length();k++){
                    QString cell_value = ui->tableWidget->item(i,2)->text();
                    QString cell_value2 = ui->tableWidget->item(i,3)->text();
                    QTableWidgetItem* item = ui->tableWidget->item(i, 13);
                    if(item == nullptr){
                        break;
                    }
                    if(!(item->text()=="")&&cell_value==ybmsame[k]&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                        tab2row++;
                        ui->tableWidget_2->setRowCount(tab2row);
                        ui->tableWidget_2->setItem(tab2row-1,1,new QTableWidgetItem(ui->tableWidget->item(i,1)->text()));
                        ui->tableWidget_2->setItem(tab2row-1,2,new QTableWidgetItem(ui->tableWidget->item(i,2)->text()));
                        double famn = QString::number(Y[k]/ybmnum[k],'f',2).toDouble();
                        double vicn = QString::number(AS[k]/ybmnum[k],'f',2).toDouble();
                        double roxn = QString::number(AL[k]/ybmnum[k],'f',2).toDouble();
                        dataca(tab2row-1,ui->tableWidget->item(i,13)->text().toDouble(),ui->tableWidget->item(i,12)->text().toDouble()
                               ,roxn,vicn,famn);
                    }
                }
            }
        }else if(afiletype=="伯乐"){
            xlsx.selectSheet("0");
            int k = 0;
            double JCV = 0;
            int count = (xlsx.dimension().rowCount()-1)/4;
            for (int i = 2; i <= xlsx.dimension().rowCount(); i++) {
                QString cell_valueYG = xlsx.read(i,3).toString();
                QString cell_valueJC = xlsx.read(i,5).toString();
                if(cell_valueJC.startsWith("Std")&&cell_valueYG=="Cy5"){
                    double cell_valueJCV = xlsx.read(i,8).toDouble();
                    QString BZP6 = QString::number(cell_valueJCV,'f',4);
                    double bzp6 = BZP6.toDouble();
                    JCV +=bzp6;
                    k++;
                }
            }

            double t = JCV/k;
            QStringList ybmsame;
            for (int i = 2; i <= xlsx.dimension().rowCount(); i++) {
                QString cell_value = xlsx.read(i,5).toString();
                QString cell_value2 = xlsx.read(i,8).toString();
                if(ybmsame.contains(cell_value)&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){

                }else if(!ybmsame.contains(cell_value)&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                    ybmsame.append(cell_value);
                }
            }
            QList<int> ybmnum;
            QList<double> AL;
            QList<double> AS;
            QList<double> Y;
            QList<double> CQ;
            for(int i=0;i<ybmsame.length();i++){
                ybmnum.append(0);
                AL.append(0);
                AS.append(0);
                Y.append(0);
                CQ.append(0);
            }
            for (int i = 2; i <= (xlsx.dimension().rowCount()-1)/4+1; i++) {
                QString cell_value = xlsx.read(i,5).toString();
                for(int j = 0;j<ybmsame.length();j++){
                    if(cell_value==ybmsame[j]){
                        double cell_valueAL = QString::number(xlsx.read(i+3*count,11).toDouble(),'f',4).toDouble();
                        double cell_valueAS = QString::number(xlsx.read(i+2*count, 11).toDouble(),'f',4).toDouble();
                        double cell_valueY = QString::number(xlsx.read(i+count, 11).toDouble(),'f',4).toDouble();
                        double cell_valueCQ = QString::number(xlsx.read(i, 8).toDouble(),'f',4).toDouble();
                        AL[j]+=cell_valueAL;
                        AS[j]+=cell_valueAS;
                        Y[j]+=cell_valueY;
                        CQ[j]+=cell_valueCQ;
                        ybmnum[j]++;
                    }
                }
            }
            ui->tableWidget->setRowCount(xlsx.dimension().rowCount()-2+1);
            for (int i = 2; i <= xlsx.dimension().rowCount(); i++) {
                for (int j = 1; j <= 6; j++) {
                    if(j==1){
                        QString cell_value = xlsx.read(i,2).toString();
                        ui->tableWidget->setItem(i-2,j,new QTableWidgetItem(cell_value));
                    }else if(j==2){
                        QString cell_value = xlsx.read(i,6).toString();
                        ui->tableWidget->setItem(i-2,j,new QTableWidgetItem(cell_value));
                    }else if(j==3){
                        QString cell_value = xlsx.read(i,5).toString();
                        ui->tableWidget->setItem(i-2,j,new QTableWidgetItem(cell_value));
                    }else if(j==4){
                        QString cell_value = xlsx.read(i,3).toString();
                        ui->tableWidget->setItem(i-2,j,new QTableWidgetItem(cell_value));
                    }else if(j==5){
                        double a = xlsx.read(i,8).toDouble();
                        QString cell_value = QString::number(a,'f',2);
                        ui->tableWidget->setItem(i-2,j,new QTableWidgetItem(cell_value));
                    }else if(j==6){
                        double a = xlsx.read(i,11).toDouble();
                        QString cell_value = QString::number(a,'f',2);
                        ui->tableWidget->setItem(i-2,j,new QTableWidgetItem(cell_value));
                    }
                }
            }
            for(int i=0;i<ui->tableWidget->rowCount();i++){
                ui->tableWidget->setItem(i,0,new QTableWidgetItem(QString::number((i+1))));
            }
            for(int i=0;i < ui->tableWidget->rowCount()/4; i++){
                for(int k = 0;k<ybmsame.length();k++){
                    QString cell_value = ui->tableWidget->item(i,2)->text();
                    QString cell_value2 = ui->tableWidget->item(i,3)->text();
                    if(cell_value==ybmsame[k]&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                        double famn = QString::number(Y[k]/ybmnum[k],'f',2).toDouble();
                        double vicn = QString::number(AS[k]/ybmnum[k],'f',2).toDouble();
                        double roxn = QString::number(AL[k]/ybmnum[k],'f',2).toDouble();
                        double cqv = QString::number(CQ[k]/ybmnum[k],'f',2).toDouble();
                        datacu(i,famn,vicn,roxn,cqv,t);
                    }
                }
                QString cell_value = ui->tableWidget->item(i,3)->text();
                if(cell_value.contains("sta",Qt::CaseInsensitive)||cell_value.contains("std",Qt::CaseInsensitive)||cell_value.contains("标准品",Qt::CaseInsensitive)){
                    ui->tableWidget->setItem(i,7,new QTableWidgetItem(ui->tableWidget->item(i+1,6)->text()));
                }
            }
            QStringList ybm;
            for(int row =0;row < ui->tableWidget->rowCount();row++){
                QString val = ui->tableWidget->item(row,2)->text();
                QString val2 = ui->tableWidget->item(row,3)->text();
                QString val3 = ui->tableWidget->item(row,4)->text();
                if(val3=="ROX"&&ybm.contains(val)&&!(val2.contains("sta",Qt::CaseInsensitive)||val2.contains("std",Qt::CaseInsensitive)||val2.contains("标准品",Qt::CaseInsensitive))){
                    for(int j = 7;j < 14;j++){
                        ui->tableWidget->setItem(row,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row-count,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row-count*2,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row-count*3,j,new QTableWidgetItem(""));
                    }
                }else if(val3=="ROX"&&!ybm.contains(val)&&!(val2.contains("sta",Qt::CaseInsensitive)||val2.contains("std",Qt::CaseInsensitive)||val2.contains("标准品",Qt::CaseInsensitive))){
                    for(int j = 7;j < 14;j++){
                        ui->tableWidget->setItem(row-count,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row-count*2,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row-count*3,j,new QTableWidgetItem(""));
                    }
                    ybm.append(val);
                }
            }
            int tab2row=2;
            for(int i=0;i < ui->tableWidget->rowCount()/4; i++){
                for(int k = 0;k<ybmsame.length();k++){
                    QString cell_value = ui->tableWidget->item(i,2)->text();
                    QString cell_value2 = ui->tableWidget->item(i,3)->text();
                    QTableWidgetItem* item = ui->tableWidget->item(i, 13);
                    if(item == nullptr){
                        break;
                    }
                    if(!(item->text()=="")&&cell_value==ybmsame[k]&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                        tab2row++;
                        ui->tableWidget_2->setRowCount(tab2row);
                        ui->tableWidget_2->setItem(tab2row-1,1,new QTableWidgetItem(ui->tableWidget->item(i,1)->text()));
                        ui->tableWidget_2->setItem(tab2row-1,2,new QTableWidgetItem(ui->tableWidget->item(i,2)->text()));
                        double famn = QString::number(Y[k]/ybmnum[k],'f',2).toDouble();
                        double vicn = QString::number(AS[k]/ybmnum[k],'f',2).toDouble();
                        double roxn = QString::number(AL[k]/ybmnum[k],'f',2).toDouble();
                        dataca(tab2row-1,ui->tableWidget->item(i,13)->text().toDouble(),ui->tableWidget->item(i,12)->text().toDouble()
                               ,roxn,vicn,famn);
                    }
                }
            }
        }else if(afiletype=="Design and Analysis-线下版"){
            xlsx.selectSheet("Standard Curve Result");
            for(int i=26;i<xlsx.dimension().rowCount();i++){
                QString cell_valueBZE = xlsx.read(i,7).toString();
                for(int j=i;j<i+4;j++){
                    QString cell_valueYE = xlsx.read(j,8).toString();
                    bzend.append(cell_valueYE);
                }
                break;
            }
            for(int i=26;i<xlsx.dimension().rowCount();i++){
                QString cell_valueBZE = xlsx.read(i,7).toString();
                if(cell_valueBZE=="UNKNOWN"){
                    for(int j=i;j<i+4;j++){
                        QString cell_valueYE = xlsx.read(j,8).toString();
                        fbzend.append(cell_valueYE);
                    }
                    break;
                }
            }
            vaend.append("ROX");
            vaend.append("VIC");
            vaend.append("FAM");
            vaend.append("CY5");
            for (int i = 0; i < 4; ++i) {
                for(int j = 0; j < 4; j++){
                    if ( vaend[i]==bzend.at(j) ) {
                        bzed.append(j);
                    }
                }
            }
            for (int i = 0; i < 4; ++i) {
                for(int j = 0; j < 4; j++){
                    if ( vaend[i]== fbzend.at(j)) {
                        fbzed.append(j);
                    }
                }
            }
            qDebug()<<bzend<<fbzend;
            qDebug()<<bzed<<fbzed;
            double RRR = xlsx.read(26+bzed[0], 27).toDouble();
            QString R1 = QString::number(RRR,'f',4);
            double RRV = xlsx.read(26+bzed[1], 27).toDouble();
            QString V1 = QString::number(RRV,'f',4);
            double RRF = xlsx.read(26+bzed[2], 27).toDouble();
            QString F1 = QString::number(RRF,'f',4);
            double JJR = xlsx.read(26+bzed[0], 26).toDouble();
            QString R2 = QString::number(JJR,'f',4);
            double JJV = xlsx.read(26+bzed[1], 26).toDouble();
            QString V2 = QString::number(JJV,'f',4);
            double JJF = xlsx.read(26+bzed[2], 26).toDouble();
            QString F2 = QString::number(JJF,'f',4);
            double XLR = xlsx.read(26+bzed[0], 29).toDouble();
            QString R3 = QString::number(XLR,'f',4);
            double XLV = xlsx.read(26+bzed[1], 29).toDouble();
            QString V3 = QString::number(XLV,'f',4);
            double XLF = xlsx.read(26+bzed[2], 29).toDouble();
            QString F3 = QString::number(XLF,'f',4);
            double XR = xlsx.read(26+bzed[0], 28).toDouble();
            QString R4 = QString::number(XR,'f',4);
            double XV = xlsx.read(26+bzed[1], 28).toDouble();
            QString V4 = QString::number(XV,'f',4);
            double XF = xlsx.read(26+bzed[2], 28).toDouble();
            QString F4 = QString::number(XF,'f',4);
            if((XLR>=90&&XLR<=110)&&RRR>0.98){
                ui->label_3->setText(" AL: R²:"+R1+" Y轴截距:"+R2+" 扩增效率:"+R3+" 斜率:"+R4+"\n");
            }else{
                ui->label_3->setText(" AL: R²:"+R1+" Y轴截距:"+R2+" 扩增效率:"+R3+" 斜率:"+R4+"\n 注意！标准曲线不合格，定量结果可能不准确！");
            }
            if((XLV>=90&&XLV<=110)&&RRV>0.98){
                ui->label_2->setText(" AS: R²:"+V1+" Y轴截距:"+V2+" 扩增效率:"+V3+" 斜率:"+V4+"\n");
            }else{
                ui->label_2->setText(" AS: R²:"+V1+" Y轴截距:"+V2+" 扩增效率:"+V3+" 斜率:"+V4+"\n 注意！标准曲线不合格，定量结果可能不准确！");
            }
            if((XLF>=90&&XLF<=110)&&RRF>0.98){
                ui->label->setText(" Y: R²:"+F1+" Y轴截距:"+F2+" 扩增效率:"+F3+" 斜率:"+F4+"\n");
            }else{
                ui->label->setText(" Y: R²:"+F1+" Y轴截距:"+F2+" 扩增效率:"+F3+" 斜率:"+F4+"\n 注意！标准曲线不合格，定量结果可能不准确！");
            }
            //            ui->label_3->setStyleSheet("QLabel{background-color: rgb(255, 165, 0);}");
            //            ui->label_2->setStyleSheet("QLabel{background-color: rgb(0, 255, 0);}");
            //            ui->label->setStyleSheet("QLabel{background-color: rgb(0, 0, 139);}");
            //将 Excel 中的数据存入一个 QStringList 对象中
            int k = 0;
            double JCV = 0;
            for (int i = 26; i <= xlsx.dimension().rowCount(); i++) {
                QString cell_valueYG = xlsx.read(i, 8).toString();
                QString cell_valueJC = xlsx.read(i, 7).toString();
                double cell_valueJCV = xlsx.read(i+bzed[3]-bzed[0], 11).toDouble();
                if(cell_valueJC=="STANDARD"&&cell_valueYG=="ROX"){
                    QString BZP6 = QString::number(cell_valueJCV,'f',4);
                    double bzp6 = BZP6.toDouble();
                    JCV +=bzp6;
                    k++;
                }
            }
            double t = JCV/k;
            QStringList ybmsame;
            for (int i = 26; i <= xlsx.dimension().rowCount(); i++) {
                QString cell_value = xlsx.read(i, 3).toString();
                QString cell_value2 = xlsx.read(i, 7).toString();
                if(ybmsame.contains(cell_value)&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){

                }else if(!ybmsame.contains(cell_value)&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                    ybmsame.append(cell_value);
                }
            }
            QList<int> ybmnum;
            QList<double> AL;
            QList<double> AS;
            QList<double> Y;
            QList<double> CQ;
            for(int i=0;i<ybmsame.length();i++){
                ybmnum.append(0);
                AL.append(0);
                AS.append(0);
                Y.append(0);
                CQ.append(0);
            }
            for (int i = 26+fbzed[0]; i <= xlsx.dimension().rowCount(); i=i+4) {
                QString cell_value = xlsx.read(i, 3).toString();
                for(int j = 0;j<ybmsame.length();j++){
                    if(cell_value==ybmsame[j]){
                        double cell_valueAL = QString::number(xlsx.read(i, 4).toDouble(),'f',4).toDouble();
                        double cell_valueAS = QString::number(xlsx.read(i+fbzed[1]-fbzed[0], 4).toDouble(),'f',4).toDouble();
                        double cell_valueY = QString::number(xlsx.read(i+fbzed[2]-fbzed[0], 4).toDouble(),'f',4).toDouble();
                        double cell_valueCQ = QString::number(xlsx.read(i+fbzed[3]-fbzed[0], 4).toDouble(),'f',4).toDouble();
                        AL[j]+=cell_valueAL;
                        AS[j]+=cell_valueAS;
                        Y[j]+=cell_valueY;
                        CQ[j]+=cell_valueCQ;
                        ybmnum[j]++;
                    }
                }
            }
            ui->tableWidget->setRowCount(xlsx.dimension().rowCount()-26+1);
            for (int i = 26; i <= xlsx.dimension().rowCount(); i++) {
                for (int j = 1; j <= 6; j++) {
                    if(j==1){
                        QString cell_value = xlsx.read(i,2).toString();
                        ui->tableWidget->setItem(i-26,j,new QTableWidgetItem(cell_value));
                    }else if(j==2){
                        QString cell_value = xlsx.read(i,3).toString();
                        ui->tableWidget->setItem(i-26,j,new QTableWidgetItem(cell_value));
                    }else if(j==3){
                        QString cell_value = xlsx.read(i,7).toString();
                        ui->tableWidget->setItem(i-26,j,new QTableWidgetItem(cell_value));
                    }else if(j==4){
                        QString cell_value = xlsx.read(i,8).toString();
                        ui->tableWidget->setItem(i-26,j,new QTableWidgetItem(cell_value));
                    }else if(j==5){
                        double a = xlsx.read(i,11).toDouble();
                        QString cell_value = QString::number(a,'f',2);
                        ui->tableWidget->setItem(i-26,j,new QTableWidgetItem(cell_value));
                    }else if(j==6){
                        double a = xlsx.read(i,4).toDouble();
                        QString cell_value = QString::number(a,'f',2);
                        ui->tableWidget->setItem(i-26,j,new QTableWidgetItem(cell_value));
                    }
                }
            }
            for(int i=0;i<ui->tableWidget->rowCount();i++){
                ui->tableWidget->setItem(i,0,new QTableWidgetItem(QString::number((i+1))));
            }
            for(int i=0;i < ui->tableWidget->rowCount(); i+=4){
                for(int k = 0;k<ybmsame.length();k++){
                    QString cell_value = ui->tableWidget->item(i,2)->text();
                    QString cell_value2 = ui->tableWidget->item(i,3)->text();
                    if(cell_value==ybmsame[k]&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                        double famn = QString::number(Y[k]/ybmnum[k],'f',2).toDouble();
                        double vicn = QString::number(AS[k]/ybmnum[k],'f',2).toDouble();
                        double roxn = QString::number(AL[k]/ybmnum[k],'f',2).toDouble();
                        double cqv = QString::number(CQ[k]/ybmnum[k],'f',2).toDouble();
                        datacu(i,famn,vicn,roxn,cqv,t);
                    }
                }
                QString cell_value = ui->tableWidget->item(i,3)->text();
                if(cell_value.contains("sta",Qt::CaseInsensitive)||cell_value.contains("std",Qt::CaseInsensitive)||cell_value.contains("标准品",Qt::CaseInsensitive)){
                    ui->tableWidget->setItem(i,7,new QTableWidgetItem(ui->tableWidget->item(i+1,6)->text()));
                }
            }
            QStringList ybm;
            for(int row =0;row < ui->tableWidget->rowCount();row++){
                QString val = ui->tableWidget->item(row,2)->text();
                QString val2 = ui->tableWidget->item(row,3)->text();
                QString val3 = ui->tableWidget->item(row,4)->text();
                if(val3=="VIC"&&ybm.contains(val)&&!(val2.contains("sta",Qt::CaseInsensitive)||val2.contains("std",Qt::CaseInsensitive)||val2.contains("标准品",Qt::CaseInsensitive))){
                    for(int j = 7;j < 14;j++){
                        ui->tableWidget->setItem(row,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+1,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+2,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+3,j,new QTableWidgetItem(""));
                    }
                }else if(val3=="VIC"&&!ybm.contains(val)&&!(val2.contains("sta",Qt::CaseInsensitive)||val2.contains("std",Qt::CaseInsensitive)||val2.contains("标准品",Qt::CaseInsensitive))){
                    for(int j = 7;j < 14;j++){
                        ui->tableWidget->setItem(row+1,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+2,j,new QTableWidgetItem(""));
                        ui->tableWidget->setItem(row+3,j,new QTableWidgetItem(""));
                    }
                    ybm.append(val);
                }
            }
            int tab2row=2;
            for(int i=0;i < ui->tableWidget->rowCount(); i+=4){
                for(int k = 0;k<ybmsame.length();k++){
                    QString cell_value = ui->tableWidget->item(i,2)->text();
                    QString cell_value2 = ui->tableWidget->item(i,3)->text();
                    QTableWidgetItem* item = ui->tableWidget->item(i, 13);
                    if(item == nullptr){
                        break;
                    }
                    if(!(item->text()=="")&&cell_value==ybmsame[k]&&!(cell_value2.contains("sta",Qt::CaseInsensitive)||cell_value2.contains("std",Qt::CaseInsensitive)||cell_value2.contains("标准品",Qt::CaseInsensitive))){
                        tab2row++;
                        ui->tableWidget_2->setRowCount(tab2row);
                        ui->tableWidget_2->setItem(tab2row-1,1,new QTableWidgetItem(ui->tableWidget->item(i,1)->text()));
                        ui->tableWidget_2->setItem(tab2row-1,2,new QTableWidgetItem(ui->tableWidget->item(i,2)->text()));
                        double famn = QString::number(Y[k]/ybmnum[k],'f',2).toDouble();
                        double vicn = QString::number(AS[k]/ybmnum[k],'f',2).toDouble();
                        double roxn = QString::number(AL[k]/ybmnum[k],'f',2).toDouble();
                        dataca(tab2row-1,ui->tableWidget->item(i,13)->text().toDouble(),ui->tableWidget->item(i,12)->text().toDouble()
                               ,roxn,vicn,famn);
                    }
                }
            }
        }
    }
    tab2xh();
}

// 数据计算总浓度-抑制指数
void DetectionAnalysis::datacu(int row,double famn,double vicn,double roxn,double cqv,double cqbz){
    double R1,R2,R3,X1;
    QSqlDatabase db = dbHelper::openConnection();
    QString sql=QString("SELECT Num FROM MixedJudgment WHERE Parameter='%1'")
            .arg("R1");
    QSqlQuery query(db);
    query.exec(sql);
    while (query.next()) {
        R1 = query.value("Num").toDouble();
    }
    sql=QString("SELECT Num FROM MixedJudgment WHERE Parameter='%1'")
            .arg("R2");
    query.exec(sql);
    while (query.next()) {
        R2 = query.value("Num").toDouble();
    }
    sql=QString("SELECT Num FROM MixedJudgment WHERE Parameter='%1'")
            .arg("R3");
    query.exec(sql);
    while (query.next()) {
        R3 = query.value("Num").toDouble();
    }
    sql=QString("SELECT Num FROM MixedJudgment WHERE Parameter='%1'")
            .arg("X1");
    query.exec(sql);
    while (query.next()) {
        X1 = query.value("Num").toDouble();
    }
    ui->tableWidget->setItem(row,7,new QTableWidgetItem(QString::number(vicn,'f',2)));
    if(famn==0){
        if(vicn<X1){
            ui->tableWidget->setItem(row,8,new QTableWidgetItem("un"));
            ui->tableWidget->setItem(row,9,new QTableWidgetItem("un"));
            ui->tableWidget->setItem(row,10,new QTableWidgetItem("浓度过低无法判断"));
            ui->tableWidget->setItem(row,11,new QTableWidgetItem("-"));
        }else if(vicn>=X1){
            ui->tableWidget->setItem(row,8,new QTableWidgetItem("un"));
            ui->tableWidget->setItem(row,9,new QTableWidgetItem(QString::number(vicn,'f',2)));
            ui->tableWidget->setItem(row,10,new QTableWidgetItem("女"));
            ui->tableWidget->setItem(row,11,new QTableWidgetItem("-"));
        }
    }else if(vicn/famn<R1){
        ui->tableWidget->setItem(row,8,new QTableWidgetItem(QString::number(famn,'f',2)));
        ui->tableWidget->setItem(row,9,new QTableWidgetItem("un"));
        ui->tableWidget->setItem(row,10,new QTableWidgetItem("男"));
        ui->tableWidget->setItem(row,11,new QTableWidgetItem("-"));
    }else if(vicn/famn>=R1&&vicn<=X1){
        ui->tableWidget->setItem(row,8,new QTableWidgetItem(QString::number(famn,'f',2)));
        ui->tableWidget->setItem(row,9,new QTableWidgetItem("un"));
        ui->tableWidget->setItem(row,10,new QTableWidgetItem("男"));
        ui->tableWidget->setItem(row,11,new QTableWidgetItem("-"));
    }else if(vicn/famn>=R1&&vicn/famn<R2&&vicn>X1){
        ui->tableWidget->setItem(row,8,new QTableWidgetItem(QString::number(famn,'f',2)));
        ui->tableWidget->setItem(row,9,new QTableWidgetItem(QString::number(vicn-famn,'f',2)));
        ui->tableWidget->setItem(row,10,new QTableWidgetItem(">70%可能混"));
        ui->tableWidget->setItem(row,11,new QTableWidgetItem("1:"+QString::number((vicn-famn)/famn,'f',2)));
    }else if(vicn/famn>=R2&&vicn/famn<R3&&vicn>X1){
        ui->tableWidget->setItem(row,8,new QTableWidgetItem(QString::number(famn,'f',2)));
        ui->tableWidget->setItem(row,9,new QTableWidgetItem(QString::number(vicn-famn,'f',2)));
        ui->tableWidget->setItem(row,10,new QTableWidgetItem(">85%可能混"));
        ui->tableWidget->setItem(row,11,new QTableWidgetItem("1:"+QString::number((vicn-famn)/famn,'f',2)));
    }else if(vicn/famn>=R3&&vicn>X1){
        ui->tableWidget->setItem(row,8,new QTableWidgetItem(QString::number(famn,'f',2)));
        ui->tableWidget->setItem(row,9,new QTableWidgetItem(QString::number(vicn-famn,'f',2)));
        ui->tableWidget->setItem(row,10,new QTableWidgetItem(">95%可能混"));
        ui->tableWidget->setItem(row,11,new QTableWidgetItem("1:"+QString::number((vicn-famn)/famn,'f',2)));
    }
    if(roxn==0){
        ui->tableWidget->setItem(row,12,new QTableWidgetItem("nan"));
    }else{
        ui->tableWidget->setItem(row,12,new QTableWidgetItem(QString::number(vicn/roxn,'f',2)));
    }

    ui->tableWidget->setItem(row,13,new QTableWidgetItem(QString::number(cqv-cqbz,'f',2)));

}

// 指导建议-稀释
void DetectionAnalysis::dataca(int row,double ICS,double DI,double AL,double AS,double Y){
    QMap<QString,QString> map;
    for(int i=0;i<STRType.length();i++){
        if(STRType.at(i)=="常STR"){
            QSqlDatabase db = dbHelper::openConnection();
            QString sql=QString("SELECT m.SystemName,m.SystemNum from DataAnalyseConfig d,ModelConfigurationNormal m where m.ID=d.ModelGuid and d.ReagentKitType='%1' and d.ReagentKitName='%2' and d.System='%3' ;")
                    .arg(STRType[i],STRName[i],STRsys[i]);
            QSqlQuery query(db);
            query.exec(sql);
            while (query.next()) {
                map.insert(query.value("SystemName").toString(),query.value("SystemNum").toString());
            }
        }else if(STRType.at(i)=="Y-STR"){
            QSqlDatabase db = dbHelper::openConnection();
            QString sql=QString("SELECT m.SystemName,m.SystemNum from DataAnalyseConfig d,ModelConfigurationY m where m.ID=d.ModelGuid and d.ReagentKitType='%1' and d.ReagentKitName='%2' and d.System='%3' ;")
                    .arg(STRType[i],STRName[i],STRsys[i]);
            QSqlQuery query(db);
            query.exec(sql);
            while (query.next()) {
                map.insert(query.value("SystemName").toString(),query.value("SystemNum").toString());
            }
        }else if(STRType.at(i)=="Mini-STR"){
            QSqlDatabase db = dbHelper::openConnection();
            QString sql=QString("SELECT m.SystemName,m.SystemNum from DataAnalyseConfig d,ModelConfigurationMini m where m.ID=d.ModelGuid and d.ReagentKitType='%1' and d.ReagentKitName='%2' and d.System='%3' ;")
                    .arg(STRType[i],STRName[i],STRsys[i]);
            QSqlQuery query(db);
            query.exec(sql);
            while (query.next()) {
                map.insert(query.value("SystemName").toString(),query.value("SystemNum").toString());
            }
        }
    }
    int a=STRType.indexOf("常STR");
    if(STRType.contains("常STR")&&STRsys.at(a)=="10"){
        map.insert("Da",QString::number(0.3*(1+(DI-1/DI))));
        map.insert("Db",QString::number(0.3*(1+(DI-1/DI))));
        map.insert("Dc",QString::number(0.3*(1+(DI-1/DI))));
        map.insert("Dd",QString::number(0.3*(1+(DI-1/DI))));
        map.insert("De",QString::number(0.3*(1+(DI-1/DI))));
        map.insert("MXa",QString::number(1.5/DI*(1+(DI-1)/DI)));
        map.insert("MXb",QString::number(1.5/DI*(1+(DI-1)/DI)));
        map.insert("MXc",QString::number(1.5/DI*(1+(DI-1)/DI)));
        map.insert("MXd",QString::number(1.5/DI*(1+(DI-1)/DI)));
        map.insert("MXe",QString::number(1.5/DI*(1+(DI-1)/DI)));
        double ASN2=map.value("Md").toDouble()/map.value("Mv").toDouble();
        double ASN3=map.value("Md").toDouble()/4;
        double ASN4=map.value("Md").toDouble()/3;
        double ASN5=map.value("Md").toDouble()/2;
        double ASN6=map.value("Mx").toDouble();
        double d = AL;
        double ALN1 = map.value("La").toDouble();
        double ALN2 = map.value("Da").toDouble()/map.value("Mv").toDouble();
        double ALN3 = map.value("Da").toDouble()/4;
        double ALN4 = map.value("Da").toDouble()/3;
        double ALN5 = map.value("Da").toDouble()/2;
        double ALN6 = map.value("MXa").toDouble();
        double ALN7 = map.value("Lb").toDouble();
        double ALN8 = map.value("Db").toDouble()/map.value("Mv").toDouble();
        double ALN9 = map.value("Db").toDouble()/4;
        double ALN10 = map.value("Db").toDouble()/3;
        double ALN11 = map.value("Db").toDouble()/2;
        double ALN12 = map.value("MXb").toDouble();
        double ALN13 = map.value("Lc").toDouble();
        double ALN14 = map.value("Dc").toDouble()/map.value("Mv").toDouble();
        double ALN15 = map.value("Dc").toDouble()/4;
        double ALN16 = map.value("Dc").toDouble()/3;
        double ALN17 = map.value("Dc").toDouble()/2;
        double ALN18 = map.value("MXc").toDouble();
        double ALN19 = map.value("Ld").toDouble();
        double ALN20 = map.value("Dd").toDouble()/map.value("Mv").toDouble();
        double ALN21 = map.value("Dd").toDouble()/4;
        double ALN22 = map.value("Dd").toDouble()/3;
        double ALN23 = map.value("Dd").toDouble()/2;
        double ALN24 = map.value("MXd").toDouble();
        double ALN25 = map.value("Le").toDouble();
        double ALN26 = map.value("De").toDouble()/map.value("Mv").toDouble();
        double ALN27 = map.value("De").toDouble()/4;
        double ALN28 = map.value("De").toDouble()/3;
        double ALN29 = map.value("De").toDouble()/2;
        double ALN30 = map.value("MXe").toDouble();
        ui->tableWidget_2->setItem(row,3,new QTableWidgetItem("常STR"));
        if(ICS>=2){
            ui->tableWidget_2->setItem(row,3,new QTableWidgetItem(map.value("检测方案")));
            ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            ui->tableWidget_2->setItem(row,12,new QTableWidgetItem(map.value("备注")));
        }if(ICS<2&&DI<1.5){
            if(AS<ASN2){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Mv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>=ASN2&&AS<=ASN3){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>ASN3&&AS<=ASN4){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>ASN4&&AS<=ASN5){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>ASN5&&AS<=ASN6){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>ASN6){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AS"+QString::number(map.value("Md").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AS/(map.value("Md").toDouble()/2))));
            }

        }else if(ICS<2&&DI>=1.5&&DI<=4){
            if(d<ALN1){
                ui->tableWidget_2->setItem(row,3,new QTableWidgetItem("mini-STR"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
                miniSTRfl=true;
            }else if(d>=ALN1&&d<=ALN2){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Mv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN2&&d<=ALN3){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN3&&d<=ALN4){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN4&&d<=ALN5){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN5&&d<=ALN6){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN6){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AL"+QString::number(map.value("Da").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AL/(map.value("Da").toDouble()/2))));
            }
        }else if(ICS<2&&DI>4&&DI<=12){
            if(d<ALN7){
                ui->tableWidget_2->setItem(row,3,new QTableWidgetItem("mini-STR"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
                miniSTRfl=true;
            }else if(d>=ALN7&&d<=ALN8){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Mv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN8&&d<=ALN9){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN9&&d<=ALN10){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN10&&d<=ALN11){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN11&&d<=ALN12){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN12){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AL"+QString::number(map.value("Db").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AL/(map.value("Db").toDouble()/2))));
            }
        }else if(ICS<2&&DI>12&&DI<=20){
            if(d<ALN13){
                ui->tableWidget_2->setItem(row,3,new QTableWidgetItem("mini-STR"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
                miniSTRfl=true;
            }else if(d>=ALN13&&d<=ALN14){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Mv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN14&&d<=ALN15){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN15&&d<=ALN16){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN16&&d<=ALN17){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN17&&d<=ALN18){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN18){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AL"+QString::number(map.value("Dc").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AL/(map.value("Dc").toDouble()/2))));
            }
        }else if(ICS<2&&DI>20&&DI<=35){
            if(d<ALN19){
                ui->tableWidget_2->setItem(row,3,new QTableWidgetItem("mini-STR"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
                miniSTRfl=true;
            }else if(d>=ALN19&&d<=ALN20){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Mv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN20&&d<=ALN21){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN21&&d<=ALN22){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN22&&d<=ALN23){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN23&&d<=ALN24){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN24){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AL"+QString::number(map.value("Dd").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AL/(map.value("Dd").toDouble()/2))));
            }
        }else if(ICS<2&&DI>35&&DI<=80){
            if(d<ALN25){
                ui->tableWidget_2->setItem(row,3,new QTableWidgetItem("mini-STR"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
                miniSTRfl=true;
            }else if(d>=ALN25&&d<=ALN26){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Mv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN26&&d<=ALN27){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN27&&d<=ALN28){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN28&&d<=ALN29){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN29&&d<=ALN30){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN30){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AL"+QString::number(map.value("De").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AL/(map.value("De").toDouble()/2))));
            }
        }else if(ICS<2&&(DI>80||DI==0)){
            if(map.value("Ni").toInt()==0){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Mv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }if(map.value("Ni").toInt()==0){
                ui->tableWidget_2->setItem(row,3,new QTableWidgetItem("mini-STR"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
                miniSTRfl=true;
            }
        }else{
            ui->tableWidget_2->setItem(row,3,new QTableWidgetItem("常STR"));
            ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Mv")+"ul"));
            ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
        }
    }
    if(STRType.contains("常STR")&&STRsys.at(a)=="15"){
        map.insert("Da*",QString::number(0.3*(1+(DI-1/DI))));
        map.insert("Db*",QString::number(0.3*(1+(DI-1/DI))));
        map.insert("Dc*",QString::number(0.3*(1+(DI-1/DI))));
        map.insert("Dd*",QString::number(0.3*(1+(DI-1/DI))));
        map.insert("De*",QString::number(0.3*(1+(DI-1/DI))));
        map.insert("MXa*",QString::number(1.5/DI*(1+(DI-1)/DI)));
        map.insert("MXb*",QString::number(1.5/DI*(1+(DI-1)/DI)));
        map.insert("MXc*",QString::number(1.5/DI*(1+(DI-1)/DI)));
        map.insert("MXd*",QString::number(1.5/DI*(1+(DI-1)/DI)));
        map.insert("MXe*",QString::number(1.5/DI*(1+(DI-1)/DI)));
        double ASN2=map.value("Md*").toDouble()/map.value("Mv*").toDouble();
        double ASN3=map.value("Md*").toDouble()/15;
        double ASN4=map.value("Md*").toDouble()/12;
        double ASN5=map.value("Md*").toDouble()/10;
        double ASN6=map.value("Md*").toDouble()/8;
        double ASN7=map.value("Md*").toDouble()/6;
        double ASN8=map.value("Md*").toDouble()/4;
        double ASN9=map.value("Md*").toDouble()/2;
        double ASN10=map.value("Mx*").toDouble();
        double d = AL;
        double ALN1 = map.value("La*").toDouble();
        double ALN2 = map.value("Da*").toDouble()/map.value("Mv*").toDouble();
        double ALN3 = map.value("Da*").toDouble()/15;
        double ALN4 = map.value("Da*").toDouble()/12;
        double ALN5 = map.value("Da*").toDouble()/10;
        double ALN6 = map.value("Da*").toDouble()/8;
        double ALN7 = map.value("Da*").toDouble()/6;
        double ALN8 = map.value("Da*").toDouble()/4;
        double ALN9 = map.value("Da*").toDouble()/2;
        double ALN10 = map.value("MXa*").toDouble();
        double ALN11 = map.value("Lb*").toDouble();
        double ALN12 = map.value("Db*").toDouble()/map.value("Mv*").toDouble();
        double ALN13 = map.value("Db*").toDouble()/15;
        double ALN14 = map.value("Db*").toDouble()/12;
        double ALN15 = map.value("Db*").toDouble()/10;
        double ALN16 = map.value("Db*").toDouble()/8;
        double ALN17 = map.value("Db*").toDouble()/6;
        double ALN18 = map.value("Db*").toDouble()/4;
        double ALN19 = map.value("Db*").toDouble()/2;
        double ALN20 = map.value("MXb*").toDouble();
        double ALN21 = map.value("Lc*").toDouble();
        double ALN22 = map.value("Dc*").toDouble()/map.value("Mv*").toDouble();
        double ALN23 = map.value("Dc*").toDouble()/15;
        double ALN24 = map.value("Dc*").toDouble()/12;
        double ALN25 = map.value("Dc*").toDouble()/10;
        double ALN26 = map.value("Dc*").toDouble()/8;
        double ALN27 = map.value("Dc*").toDouble()/6;
        double ALN28 = map.value("Dc*").toDouble()/4;
        double ALN29 = map.value("Dc*").toDouble()/2;
        double ALN30 = map.value("MXc*").toDouble();
        double ALN31 = map.value("Ld*").toDouble();
        double ALN32 = map.value("Dd*").toDouble()/map.value("Mv*").toDouble();
        double ALN33 = map.value("Dd*").toDouble()/15;
        double ALN34 = map.value("Dd*").toDouble()/12;
        double ALN35 = map.value("Dd*").toDouble()/10;
        double ALN36 = map.value("Dd*").toDouble()/8;
        double ALN37 = map.value("Dd*").toDouble()/6;
        double ALN38 = map.value("Dd*").toDouble()/4;
        double ALN39 = map.value("Dd*").toDouble()/2;
        double ALN40 = map.value("MXd*").toDouble();
        double ALN41 = map.value("Le*").toDouble();
        double ALN42 = map.value("De*").toDouble()/map.value("Mv*").toDouble();
        double ALN43 = map.value("De*").toDouble()/15;
        double ALN44 = map.value("De*").toDouble()/12;
        double ALN45 = map.value("De*").toDouble()/10;
        double ALN46 = map.value("De*").toDouble()/8;
        double ALN47 = map.value("De*").toDouble()/6;
        double ALN48 = map.value("De*").toDouble()/4;
        double ALN49 = map.value("De*").toDouble()/2;
        double ALN50 = map.value("MXe*").toDouble();
        ui->tableWidget_2->setItem(row,3,new QTableWidgetItem("常STR"));
        if(ICS>=2){
            ui->tableWidget_2->setItem(row,3,new QTableWidgetItem(map.value("检测方案")));
            ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            ui->tableWidget_2->setItem(row,12,new QTableWidgetItem(map.value("备注")));
        }if(ICS<2&&DI<1.5){
            if(AS<ASN2){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Mv*")));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>=ASN2&&AS<=ASN3){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("15ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>ASN3&&AS<=ASN4){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("12ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>ASN4&&AS<=ASN5){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("10ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>ASN5&&AS<=ASN6){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("8ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>ASN6&&AS<=ASN7){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("6ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>ASN7&&AS<=ASN8){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>ASN8&&AS<=ASN9){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>ASN9&&AS<=ASN10){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>ASN10){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AS"+QString::number(map.value("Md*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AS/(map.value("Md*").toDouble()/2))));
            }

        }else if(ICS<2&&DI>=1.5&&DI<=4){
            if(d<ALN1){
                ui->tableWidget_2->setItem(row,3,new QTableWidgetItem("mini-STR"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>=ALN1&&d<=ALN2){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Mv*")));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN2&&d<=ALN3){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("15ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN3&&d<=ALN4){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("12ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN4&&d<=ALN5){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("10ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN5&&d<=ALN6){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("8ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN6&&d<=ALN7){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("6ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN7&&d<=ALN8){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN8&&d<=ALN9){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN9&&d<=ALN10){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN10){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AL"+QString::number(map.value("Da*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AL/(map.value("Da*").toDouble()/2))));
            }
        }else if(ICS<2&&DI>4&&DI<=12){
            if(d<ALN11){
                ui->tableWidget_2->setItem(row,3,new QTableWidgetItem("mini-STR"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>=ALN11&&d<=ALN12){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Mv*")));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN12&&d<=ALN13){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("15ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN13&&d<=ALN14){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("12ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN14&&d<=ALN15){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("10ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN15&&d<=ALN16){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("8ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN16&&d<=ALN17){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("6ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN17&&d<=ALN18){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN18&&d<=ALN19){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN19&&d<=ALN20){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN20){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AL"+QString::number(map.value("Db*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AL/(map.value("Db*").toDouble()/2))));
            }
        }else if(ICS<2&&DI>12&&DI<=20){
            if(d<ALN21){
                ui->tableWidget_2->setItem(row,3,new QTableWidgetItem("mini-STR"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>=ALN21&&d<=ALN22){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Mv*")));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN22&&d<=ALN23){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("15ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN23&&d<=ALN24){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("12ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN24&&d<=ALN25){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("8ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN25&&d<=ALN26){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("6ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN26&&d<=ALN27){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN27&&d<=ALN28){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN28&&d<=ALN29){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN29&&d<=ALN30){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN30){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AL"+QString::number(map.value("Dc*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AL/(map.value("Dc*").toDouble()/2))));
            }
        }else if(ICS<2&&DI>20&&DI<=35){
            if(d<ALN31){
                ui->tableWidget_2->setItem(row,3,new QTableWidgetItem("mini-STR"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>=ALN31&&d<=ALN32){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Mv*")));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN32&&d<=ALN33){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("15ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN33&&d<=ALN34){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("12ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN34&&d<=ALN35){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("10ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN35&&d<=ALN36){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("8ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN36&&d<=ALN37){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("6ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN37&&d<=ALN38){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN38&&d<=ALN39){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN39&&d<=ALN40){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN40){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AL"+QString::number(map.value("Dd*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AL/(map.value("Dd*").toDouble()/2))));
            }
        }else if(ICS<2&&DI>35&&DI<=80){
            if(d<ALN41){
                ui->tableWidget_2->setItem(row,3,new QTableWidgetItem("mini-STR"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>=ALN41&&d<=ALN42){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Mv*")));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN42&&d<=ALN43){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("15ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN43&&d<=ALN44){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("12ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN44&&d<=ALN45){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("10ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN45&&d<=ALN46){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("8ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN46&&d<=ALN47){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("6ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN47&&d<=ALN48){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN48&&d<=ALN49){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN49&&d<=ALN50){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>ALN50){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AL"+QString::number(map.value("De*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AL/(map.value("De*").toDouble()/2))));
            }
        }else if(ICS<2&&(DI>80||DI==0)){
            if(map.value("Ni").toInt()==0){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Mv*")));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }if(map.value("Ni").toInt()==0){
                ui->tableWidget_2->setItem(row,3,new QTableWidgetItem("mini-STR"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }
        }else{
            ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Mv*")));
            ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
        }
    }
    if(YSTRfl&&STRType.contains("Y-STR")){
        map.insert("YDa",QString::number(1.1*(1+(DI-1)/DI)));
        map.insert("YDb",QString::number(1.1*(1+(DI-1)/DI)));
        map.insert("YDc",QString::number(1.1*(1+(DI-1)/DI)));
        map.insert("YDd",QString::number(1.1*(1+(DI-1)/DI)));
        map.insert("YDe",QString::number(1.1*(1+(DI-1)/DI)));
        map.insert("YXa",QString::number(1.2*(1+(DI-1)/DI)));
        map.insert("YXb",QString::number(1.2*(1+(DI-1)/DI)));
        map.insert("YXc",QString::number(1.2*(1+(DI-1)/DI)));
        map.insert("YXd",QString::number(1.2*(1+(DI-1)/DI)));
        map.insert("YXe",QString::number(1.2*(1+(DI-1)/DI)));
        double d = Y;
        double Y1 = map.value("Yd").toDouble()/map.value("Yv").toDouble();
        double Y2 = map.value("Yd").toDouble()/4;
        double Y3 = map.value("Yd").toDouble()/3;
        double Y4 = map.value("Yd").toDouble()/2;
        double Y5 = map.value("Yx").toDouble();
        double Y6 = map.value("YDa").toDouble()/map.value("Yv").toDouble();
        double Y7 = map.value("YDa").toDouble()/4;
        double Y8 = map.value("YDa").toDouble()/3;
        double Y9 = map.value("YDa").toDouble()/2;
        double Y10 = map.value("YDa").toDouble()/1.5;
        double Y11 = map.value("YXa").toDouble();
        double Y12 = map.value("YDb").toDouble()/map.value("Yv").toDouble();
        double Y13 = map.value("YDb").toDouble()/4;
        double Y14 = map.value("YDb").toDouble()/3;
        double Y15 = map.value("YDb").toDouble()/2;
        double Y16 = map.value("YDb").toDouble()/1.5;
        double Y17 = map.value("YXb").toDouble();
        double Y18 = map.value("YDc").toDouble()/map.value("Yv").toDouble();
        double Y19 = map.value("YDc").toDouble()/4;
        double Y20 = map.value("YDc").toDouble()/3;
        double Y21 = map.value("YDc").toDouble()/2;
        double Y22 = map.value("YDc").toDouble()/1.5;
        double Y23 = map.value("YXc").toDouble();
        double Y24 = map.value("YDd").toDouble()/map.value("Yv").toDouble();
        double Y25 = map.value("YDd").toDouble()/4;
        double Y26 = map.value("YDd").toDouble()/3;
        double Y27 = map.value("YDd").toDouble()/2;
        double Y28 = map.value("YDd").toDouble()/1.5;
        double Y29 = map.value("YXd").toDouble();
        double Y30 = map.value("YDe").toDouble()/map.value("Yv").toDouble();
        double Y31 = map.value("YDe").toDouble()/4;
        double Y32 = map.value("YDe").toDouble()/3;
        double Y33 = map.value("YDe").toDouble()/2;
        double Y34 = map.value("YDe").toDouble()/1.5;
        double Y35 = map.value("YXe").toDouble();
        ui->tableWidget_2->setItem(row,3,new QTableWidgetItem("Y-STR"));
        if(DI<=2){
            if(d<Y1){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Yv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>=Y1&&d<=Y2){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y2&&d<=Y3){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y3&&d<=Y4){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y4&&d<=Y5){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y5){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至Y"+QString::number(map.value("Yd*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(Y/(map.value("Yd*").toDouble()/2))));
            }
        }else if(DI>2&&DI<=4){
            if(d<Y6){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Yv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>=Y6&&d<=Y7){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y7&&d<=Y8){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y8&&d<=Y9){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y9&&d<=Y10){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1.5ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y10&&d<=Y11){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y11){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至Y"+QString::number(map.value("YDa*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(Y/(map.value("YDa*").toDouble()/2))));
            }
        }else if(DI>4&&DI<=12){
            if(d<Y12){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Yv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>=Y12&&d<=Y13){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y13&&d<=Y14){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y14&&d<=Y15){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y15&&d<=Y16){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1.5ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y16&&d<=Y17){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y17){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至Y"+QString::number(map.value("YDb*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(Y/(map.value("YDb*").toDouble()/2))));
            }
        }else if(DI>12&&DI<=20){
            if(d<Y18){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Yv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>=Y18&&d<=Y19){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y19&&d<=Y20){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y20&&d<=Y21){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y21&&d<=Y22){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1.5ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y22&&d<=Y23){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y23){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至Y"+QString::number(map.value("YDc*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(Y/(map.value("YDc*").toDouble()/2))));
            }
        }else if(DI>20&&DI<=35){
            if(d<Y24){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Yv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>=Y24&&d<=Y25){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y25&&d<=Y26){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y26&&d<=Y27){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y27&&d<=Y28){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1.5ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y28&&d<=Y29){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y29){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至Y"+QString::number(map.value("YDd*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(Y/(map.value("YDd*").toDouble()/2))));
            }
        }else if(DI>35&&DI<=80){
            if(d<Y30){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Yv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>=Y30&&d<=Y31){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y31&&d<=Y32){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y32&&d<=Y33){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y33&&d<=Y34){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1.5ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y34&&d<=Y35){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>Y35){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至Y"+QString::number(map.value("YDe*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(Y/(map.value("YDe*").toDouble()/2))));
            }
        }else if(DI>80||DI==0){
            if(map.value("Ni").toInt()==1){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Yv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(map.value("Ni").toInt()==0){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("")));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }
        }else{
            ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("")));
            ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
        }
    }
    if(miniSTRfl&&STRType.contains("Mini-STR")&&ui->tableWidget_2->item(row,3)->text()=="mini-STR"){
        map.insert("Ia",QString::number(0.25*(1+(DI-1)/DI)));
        map.insert("Ib",QString::number(0.25*(1+(DI-1)/DI)));
        map.insert("Ic",QString::number(0.25*(1+(DI-1)/DI)));
        map.insert("Id",QString::number(0.25*(1+(DI-1)/DI)));
        map.insert("Ie",QString::number(0.25*(1+(DI-1)/DI)));
        map.insert("IXa",QString::number(1.2*(1+(DI-1)/DI)));
        map.insert("IXb",QString::number(1.2*(1+(DI-1)/DI)));
        map.insert("IXc",QString::number(1.2*(1+(DI-1)/DI)));
        map.insert("IXd",QString::number(1.2*(1+(DI-1)/DI)));
        map.insert("IXe",QString::number(1.2*(1+(DI-1)/DI)));
        double d = AL;
        double M1 = map.value("Is").toDouble()/map.value("Iv").toDouble();
        double M2 = map.value("Is").toDouble()/4;
        double M3 = map.value("Is").toDouble()/3;
        double M4 = map.value("Is").toDouble()/2;
        double M5 = map.value("Ix").toDouble();
        double M6 = map.value("Ia").toDouble()/map.value("Iv").toDouble();
        double M7 = map.value("Ia").toDouble()/4;
        double M8 = map.value("Ia").toDouble()/3;
        double M9 = map.value("Ia").toDouble()/2;
        double M10 = map.value("IXa").toDouble();
        double M11 = map.value("Ib").toDouble()/map.value("Iv").toDouble();
        double M12 = map.value("Ib").toDouble()/4;
        double M13 = map.value("Ib").toDouble()/3;
        double M14 = map.value("Ib").toDouble()/2;
        double M15 = map.value("IXb").toDouble();
        double M16 = map.value("Ic").toDouble()/map.value("Iv").toDouble();
        double M17 = map.value("Ic").toDouble()/4;
        double M18 = map.value("Ic").toDouble()/3;
        double M19 = map.value("Ic").toDouble()/2;
        double M20 = map.value("IXc").toDouble();
        double M21 = map.value("Id").toDouble()/map.value("Iv").toDouble();
        double M22 = map.value("Id").toDouble()/4;
        double M23 = map.value("Id").toDouble()/3;
        double M24 = map.value("Id").toDouble()/2;
        double M25 = map.value("IXd").toDouble();
        double M26 = map.value("Ie").toDouble()/map.value("Iv").toDouble();
        double M27 = map.value("Ie").toDouble()/4;
        double M28 = map.value("Ie").toDouble()/3;
        double M29 = map.value("Ie").toDouble()/2;
        double M30 = map.value("IXe").toDouble();
        if(DI<1.5){
            if(AS<M1){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Iv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>=M1&&AS<=M2){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>M2&&AS<=M3){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>M3&&AS<=M4){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>M4&&AS<=M5){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(AS>M5){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AS"+QString::number(map.value("Is*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AS/(map.value("Is*").toDouble()/2))));
            }
        }else if(DI>=1.5&&DI<=4){
            if(d<M6){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Iv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>=M6&&d<=M7){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M7&&d<=M8){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M8&&d<=M9){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M9&&d<=M10){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M10){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AL"+QString::number(map.value("Ia*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AL/(map.value("Ia*").toDouble()/2))));
            }
        }else if(DI>4&&DI<=12){
            if(d<M11){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Iv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>=M11&&d<=M12){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M12&&d<=M13){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M13&&d<=M14){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M14&&d<=M15){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M15){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AL"+QString::number(map.value("Ib*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AL/(map.value("Ib*").toDouble()/2))));
            }
        }else if(DI>12&&DI<=20){
            if(d<M16){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Iv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>=M16&&d<=M17){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M17&&d<=M18){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M18&&d<=M19){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M19&&d<=M20){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M20){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AL"+QString::number(map.value("Ic*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AL/(map.value("Ic*").toDouble()/2))));
            }
        }else if(DI>20&&DI<=35){
            if(d<M21){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Iv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>=M21&&d<=M22){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M22&&d<=M23){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M23&&d<=M24){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M24&&d<=M25){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M25){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AL"+QString::number(map.value("Id*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AL/(map.value("Id*").toDouble()/2))));
            }
        }else if(DI>35&&DI<=80){
            if(d<M26){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Iv")+"ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>=M26&&d<=M27){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("4ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M27&&d<=M28){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("3ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M28&&d<=M29){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M29&&d<=M30){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("1ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
            }else if(d>M30){
                ui->tableWidget_2->setItem(row,11,new QTableWidgetItem("稀释至AL"+QString::number(map.value("Ie*").toDouble()/2)+"ng/ul上样2ul"));
                ui->tableWidget_2->setItem(row,4,new QTableWidgetItem(QString::number(AL/(map.value("Ie*").toDouble()/2))));
            }
        }else if(DI>80||DI==0){
            ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Iv")+"ul"));
            ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
        }else{
            ui->tableWidget_2->setItem(row,11,new QTableWidgetItem(map.value("Iv")+"ul"));
            ui->tableWidget_2->setItem(row,4,new QTableWidgetItem("无"));
        }
    }
    xsui(row,ui->tableWidget_2->item(row,3)->text(),5);
    miniSTRfl=false;
}

// tab2
void DetectionAnalysis::tab2(){
    ui->tableWidget_2->setColumnCount(13);
    ui->tableWidget_2->setRowCount(2);
    ui->tableWidget_2->setWindowTitle("QTableWidget & Item");
    ui->tableWidget_2->horizontalHeader()->hide();//取消列号
    ui->tableWidget_2->verticalHeader()->hide();//取消行号
    ui->tableWidget_2->setItem(0,0,new QTableWidgetItem("序号"));
    ui->tableWidget_2->setItem(0,1,new QTableWidgetItem("孔位"));
    ui->tableWidget_2->setItem(0,2,new QTableWidgetItem("样本名称"));
    ui->tableWidget_2->setItem(0,3,new QTableWidgetItem("检测方案"));
    ui->tableWidget_2->setItem(0,4,new QTableWidgetItem("总稀释倍数\nDFa"));
    ui->tableWidget_2->setItem(0,5,new QTableWidgetItem("第一步稀释步骤"));
    ui->tableWidget_2->setItem(1,5,new QTableWidgetItem("稀释倍数1\nDFa1"));
    ui->tableWidget_2->setItem(1,6,new QTableWidgetItem("样品体积\n(μl)"));
    ui->tableWidget_2->setItem(1,7,new QTableWidgetItem("稀释液体积\n(μl)"));
    ui->tableWidget_2->setItem(0,8,new QTableWidgetItem("第二步稀释步骤"));
    ui->tableWidget_2->setItem(1,8,new QTableWidgetItem("稀释倍数2\nDFa2"));
    ui->tableWidget_2->setItem(1,9,new QTableWidgetItem("上一步稀释\n产物(μl)"));
    ui->tableWidget_2->setItem(1,10,new QTableWidgetItem("稀释液体积\n(μl)"));
    ui->tableWidget_2->setItem(0,11,new QTableWidgetItem("扩增上样体积"));
    ui->tableWidget_2->setItem(0,12,new QTableWidgetItem("备注"));
    ui->tableWidget_2->setSpan(0, 0, 2, 1);
    ui->tableWidget_2->setSpan(0, 1, 2, 1);
    ui->tableWidget_2->setSpan(0, 2, 2, 1);
    ui->tableWidget_2->setSpan(0, 3, 2, 1);
    ui->tableWidget_2->setSpan(0, 4, 2, 1);
    ui->tableWidget_2->setSpan(0, 5, 1, 3);
    ui->tableWidget_2->setSpan(0, 8, 1, 3);
    ui->tableWidget_2->setSpan(0, 11, 2, 1);
    ui->tableWidget_2->setSpan(0, 12, 2, 1);
    ui->tableWidget_2->show();
}

void DetectionAnalysis::on_SaveBtn_2_clicked()
{
    int tabnum = tabifl;
    QString path=QString("/path/to/default/%1").arg("");
    QString filePath = QFileDialog::getSaveFileName(this, "保存", path,"Excel Files (*.xlsx)");

    QList<QString> allInfo;
    QList<QString> YstrInfo;
    QList<QString> MiniStrInfo;

    if(filePath.isEmpty()&&filePath.isNull()){
        return;
    }
    else
    {
        QXlsx::Document xlsx;

        int finalRowNum=4;
        xlsx.addSheet("下游操作建议");

        xlsx.write("A1",ui->pushButton->text());
        xlsx.write("B1","筛选数量:");
        xlsx.write("C1",ui->pushButton_5->text());
        xlsx.write("D1",ui->pushButton_4->text());
        xlsx.write("F1",ui->pushButton_2->text());

        xlsx.write("A2","样品位置(所有样品)");
        xlsx.write("B2","检材编号");
        xlsx.write("C2","检测方案(链接常-STR模型“检测方案”)");
        xlsx.write("D2","总稀释倍数DFa(链接常-STR模型相应“总稀释倍数DFa”)");
        xlsx.mergeCells("E2:G2");
        xlsx.write("E2","第一步稀释方案");
        xlsx.mergeCells("H2:J2");
        xlsx.write("H2","第二步稀释方案");
        xlsx.write("K2","STR扩增模板体积(链接常、Mini-STR模型相应“STR扩增模板体积”)");
        xlsx.write("L2","备注");

        xlsx.write("E3","稀释倍数1 \n DFa1");
        xlsx.write("F3","样品体积(ul)");
        xlsx.write("G3","稀释液体积(ul)");
        xlsx.write("H3","稀释倍数2 \n DFa1");
        xlsx.write("I3","上一步稀释产物(ul)");
        xlsx.write("J3","稀释液体积(ul)");

        QList<QString> label;
        label<<""<<"A"<<"B"<<"C"<<"D"<<"E"<<"F"<<"G"<<"H"<<"I"<<"J"<<"K"<<"L";

        on_pushButton_clicked();

        if(ui->tableWidget_2->rowCount()>0){
            for (int i=2;i<ui->tableWidget_2->rowCount();i++)
            {
                for (int m=1;m<label.length();m++) {
                    QString info;
                    QTableWidgetItem *item = ui->tableWidget_2->item(i,m);
                    if(item==nullptr){
                        info="——";
                    }else{
                        info =ui->tableWidget_2->item(i,m)->text();
                        qDebug()<<info;
                    }
                    if(m==5 && (info=="——" || info=="无"))
                    {
                        xlsx.mergeCells("E"+QString::number(finalRowNum)+":"+"G"+QString::number(finalRowNum));
                        xlsx.write("E"+QString(finalRowNum),info);
                        m=7;
                    }
                    else if(m==8 && (info=="——" || info=="无")){
                        xlsx.mergeCells("H"+QString::number(finalRowNum)+":"+"J"+QString::number(finalRowNum));
                        xlsx.write("H"+QString::number(finalRowNum),info);
                        m=10;
                    }else{
                        xlsx.write(label[m]+QString::number(finalRowNum),info);
                        qDebug()<<label[m]+QString::number(finalRowNum);
                    }
                }
                finalRowNum++;
            }
        }
        else{
            finalRowNum = 6;
        }

        xlsx.write("A"+QString::number(finalRowNum),"筛选:需稀释检材");

        xlsx.write("A"+QString::number(finalRowNum+1),"样品位置(所有样品)");
        xlsx.write("B"+QString::number(finalRowNum+1),"检材编号");
        xlsx.write("C"+QString::number(finalRowNum+1),"检测方案(链接常-STR模型“检测方案”)");
        xlsx.write("D"+QString::number(finalRowNum+1),"总稀释倍数DFa(链接常-STR模型相应“总稀释倍数DFa”)");
        xlsx.mergeCells("E"+QString::number(finalRowNum+1)+":"+"G"+QString::number(finalRowNum+1));
        xlsx.write("E"+QString::number(finalRowNum+1),"第一步稀释方案");
        xlsx.mergeCells("H"+QString::number(finalRowNum+1)+":"+"J"+QString::number(finalRowNum+1));
        xlsx.write("H"+QString::number(finalRowNum+1),"第二步稀释方案");
        xlsx.write("K"+QString::number(finalRowNum+1),"STR扩增模板体积(链接常、Mini-STR模型相应“STR扩增模板体积”)");
        xlsx.write("L"+QString::number(finalRowNum+1),"备注");

        xlsx.write("E"+QString::number(finalRowNum+2),"稀释倍数1 \r DFa1");
        xlsx.write("F"+QString::number(finalRowNum+2),"样品体积(ul)");
        xlsx.write("G"+QString::number(finalRowNum+2),"稀释液体积(ul)");
        xlsx.write("H"+QString::number(finalRowNum+2),"稀释倍数2 \n DFa1");
        xlsx.write("I"+QString::number(finalRowNum+2),"上一步稀释产物(ul)");
        xlsx.write("J"+QString::number(finalRowNum+2),"稀释液体积(ul)");

        on_pushButton_5_clicked();
        if(ui->tableWidget_2->rowCount()>0){
            finalRowNum=finalRowNum+3;
            for (int i=2;i<ui->tableWidget_2->rowCount();i++)
            {
                for (int m=1;m<label.length();m++) {
                    QString info;
                    QTableWidgetItem *item = ui->tableWidget_2->item(i,m);
                    if(item==nullptr){
                        info="——";
                    }else{
                        info =ui->tableWidget_2->item(i,m)->text();
                        qDebug()<<info;
                    }
                    if(m==5 && (info=="——" || info=="无"))
                    {
                        xlsx.mergeCells("E"+QString::number(finalRowNum)+":"+"G"+QString::number(finalRowNum));
                        xlsx.write("E"+QString(finalRowNum),info);
                        m=7;
                    }
                    else if(m==8 && (info=="——" || info=="无")){
                        xlsx.mergeCells("H"+QString::number(finalRowNum)+":"+"J"+QString::number(finalRowNum));
                        xlsx.write("H"+QString::number(finalRowNum),info);
                        m=10;
                    }else{
                        qDebug()<<label[m]+QString::number(finalRowNum);
                        xlsx.write(label[m]+QString::number(finalRowNum),info);
                    }
                }
                finalRowNum++;
            }
        }else{
            finalRowNum=11;
        }

        xlsx.write("A"+QString::number(finalRowNum),"筛选:需做Y-STR检材");

        xlsx.write("A"+QString::number(finalRowNum+1),"样品位置(所有样品)");
        xlsx.write("B"+QString::number(finalRowNum+1),"检材编号");
        xlsx.write("C"+QString::number(finalRowNum+1),"检测方案(链接常-STR模型“检测方案”)");
        xlsx.write("D"+QString::number(finalRowNum+1),"总稀释倍数DFa(链接常-STR模型相应“总稀释倍数DFa”)");
        xlsx.mergeCells("E"+QString::number(finalRowNum+1)+":"+"G"+QString::number(finalRowNum+1));
        xlsx.write("E"+QString::number(finalRowNum+1),"第一步稀释方案");
        xlsx.mergeCells("H"+QString::number(finalRowNum+1)+":"+"J"+QString::number(finalRowNum+1));
        xlsx.write("H"+QString::number(finalRowNum+1),"第二步稀释方案");
        xlsx.write("K"+QString::number(finalRowNum+1),"STR扩增模板体积(链接常、Mini-STR模型相应“STR扩增模板体积”)");
        xlsx.write("L"+QString::number(finalRowNum+1),"备注");

        xlsx.write("E"+QString::number(finalRowNum+2),"稀释倍数1 \r DFa1");
        xlsx.write("F"+QString::number(finalRowNum+2),"样品体积(ul)");
        xlsx.write("G"+QString::number(finalRowNum+2),"稀释液体积(ul)");
        xlsx.write("H"+QString::number(finalRowNum+2),"稀释倍数2 \n DFa1");
        xlsx.write("I"+QString::number(finalRowNum+2),"上一步稀释产物(ul)");
        xlsx.write("J"+QString::number(finalRowNum+2),"稀释液体积(ul)");


        on_pushButton_3_clicked();
        if(ui->tableWidget_2->rowCount()>0){
            finalRowNum=finalRowNum+3;
            for (int i=2;i<ui->tableWidget_2->rowCount();i++)
            {
                for (int m=1;m<label.length();m++) {
                    QString info;
                    QTableWidgetItem *item = ui->tableWidget_2->item(i,m);
                    if(item==nullptr){
                        info="——";
                    }else{
                        info =ui->tableWidget_2->item(i,m)->text();
                        qDebug()<<info;
                    }
                    if(m==5 && (info=="——" || info=="无"))
                    {
                        xlsx.mergeCells("E"+QString::number(finalRowNum)+":"+"G"+QString::number(finalRowNum));
                        xlsx.write("E"+QString(finalRowNum),info);
                        m=7;
                    }
                    else if(m==8 && (info=="——" || info=="无")){
                        xlsx.mergeCells("H"+QString::number(finalRowNum)+":"+"J"+QString::number(finalRowNum));
                        xlsx.write("H"+QString::number(finalRowNum),info);
                        m=10;
                    }else{
                        qDebug()<<label[m]+QString::number(finalRowNum);
                        xlsx.write(label[m]+QString::number(finalRowNum),info);
                    }
                }
                finalRowNum++;
            }
        }
        else
        {
            finalRowNum=16;
        }

        xlsx.write("A"+QString::number(finalRowNum),"筛选:需做mini-STR检材");

        xlsx.write("A"+QString::number(finalRowNum+1),"样品位置(所有样品)");
        xlsx.write("B"+QString::number(finalRowNum+1),"检材编号");
        xlsx.write("C"+QString::number(finalRowNum+1),"检测方案(链接常-STR模型“检测方案”)");
        xlsx.write("D"+QString::number(finalRowNum+1),"总稀释倍数DFa(链接常-STR模型相应“总稀释倍数DFa”)");
        xlsx.mergeCells("E"+QString::number(finalRowNum+1)+":"+"G"+QString::number(finalRowNum+1));
        xlsx.write("E"+QString::number(finalRowNum+1),"第一步稀释方案");
        xlsx.mergeCells("H"+QString::number(finalRowNum+1)+":"+"J"+QString::number(finalRowNum+1));
        xlsx.write("H"+QString::number(finalRowNum+1),"第二步稀释方案");
        xlsx.write("K"+QString::number(finalRowNum+1),"STR扩增模板体积(链接常、Mini-STR模型相应“STR扩增模板体积”)");
        xlsx.write("L"+QString::number(finalRowNum+1),"备注");

        xlsx.write("E"+QString::number(finalRowNum+2),"稀释倍数1 \r DFa1");
        xlsx.write("F"+QString::number(finalRowNum+2),"样品体积(ul)");
        xlsx.write("G"+QString::number(finalRowNum+2),"稀释液体积(ul)");
        xlsx.write("H"+QString::number(finalRowNum+2),"稀释倍数2 \n DFa1");
        xlsx.write("I"+QString::number(finalRowNum+2),"上一步稀释产物(ul)");
        xlsx.write("J"+QString::number(finalRowNum+2),"稀释液体积(ul)");


        on_pushButton_4_clicked();

        if(ui->tableWidget_2->rowCount()>0){
            finalRowNum=finalRowNum+3;
            for (int i=2;i<ui->tableWidget_2->rowCount();i++)
            {
                for (int m=1;m<label.length();m++) {
                    QString info;
                    QTableWidgetItem *item = ui->tableWidget_2->item(i,m);
                    if(item==nullptr){
                        info="——";
                    }else{
                        info =ui->tableWidget_2->item(i,m)->text();
                        qDebug()<<info;
                    }
                    if(m==5 && (info=="——" || info=="无"))
                    {
                        xlsx.mergeCells("E"+QString::number(finalRowNum)+":"+"G"+QString::number(finalRowNum));
                        xlsx.write("E"+QString(finalRowNum),info);
                        m=7;
                    }
                    else if(m==8 && (info=="——" || info=="无")){
                        xlsx.mergeCells("H"+QString::number(finalRowNum)+":"+"J"+QString::number(finalRowNum));
                        xlsx.write("H"+QString::number(finalRowNum),info);
                        m=10;
                    }else{
                        qDebug()<<label[m]+QString::number(finalRowNum);
                        xlsx.write(label[m]+QString::number(finalRowNum),info);
                    }
                }
                finalRowNum++;
            }
        }

        xlsx.addSheet("加样表格");

        QList<QString> rowList;
        rowList<<"B"<<"C"<<"D"<<"E"<<"F"<<"G"<<"H"<<"I"<<"J"<<"K"<<"L"<<"M";

        QList<QString> columList;
        columList<<"A"<<"B"<<"C"<<"D"<<"E"<<"F"<<"G"<<"H";


        xlsx.write("A1","常-STR加样表格");
        for (int i=0;i<rowList.length();i++) {
            xlsx.write(rowList[i]+"2",QString::number(i+1));
        }
        for (int i=0;i<columList.length();i++)
        {
            xlsx.write("A"+QString::number(i+3),columList[i]);
        }

        xlsx.write("A12","Y-STR加样表格");
        for (int i=0;i<rowList.length();i++) {
            xlsx.write(rowList[i]+"13",QString::number(i+1));
        }
        for (int i=0;i<columList.length();i++)
        {
            xlsx.write("A"+QString::number(i+14),columList[i]);
        }

        xlsx.write("A23","mini-STR加样表格");
        for (int i=0;i<rowList.length();i++) {
            xlsx.write(rowList[i]+"24",QString::number(i+1));
        }
        for (int i=0;i<columList.length();i++)
        {
            xlsx.write("A"+QString::number(i+25),columList[i]);
        }

        on_pushButton_2_clicked();
        for (int i=2;i<ui->tableWidget_2->rowCount();i++){
            QString pos=ui->tableWidget_2->item(i,1)->text();

            QString info;
            QTableWidgetItem *item = ui->tableWidget_2->item(i,11);
            if(item==nullptr){
                info="——";
            }else{
                info =ui->tableWidget_2->item(i,11)->text();
            }

            QString rowInfo;
            QString colInfo;

            if(pos.length()==3){
                rowInfo= pos.left(1);
                colInfo=pos.right(2);
            }else{
                rowInfo= pos.left(1);
                colInfo=pos.right(1);
            }

            QString finalPos = rowList[colInfo.toInt()-1]+ QString::number(columList.indexOf(rowInfo)+3);
            xlsx.write(finalPos,info);
        }

        on_pushButton_3_clicked();
        for (int i=2;i<ui->tableWidget_2->rowCount();i++){
            QString pos=ui->tableWidget_2->item(i,1)->text();
            QString info;
            QTableWidgetItem *item = ui->tableWidget_2->item(i,11);
            if(item==nullptr){
                info="——";
            }else{
                info =ui->tableWidget_2->item(i,11)->text();
            }
            QString rowInfo;
            QString colInfo;

            if(pos.length()==3){
                rowInfo= pos.left(1);
                colInfo=pos.right(2);
            }else{
                rowInfo= pos.left(1);
                colInfo=pos.right(1);
            }


            QString finalPos = rowList[colInfo.toInt()-1]+ QString::number(columList.indexOf(rowInfo)+14);

            xlsx.write(finalPos,info);
        }

        on_pushButton_4_clicked();
        for (int i=2;i<ui->tableWidget_2->rowCount();i++){
            QString pos=ui->tableWidget_2->item(i,1)->text();
            QString info;
            QTableWidgetItem *item = ui->tableWidget_2->item(i,11);
            if(item==nullptr){
                info="——";
            }else{
                info =ui->tableWidget_2->item(i,11)->text();
            }
            QString rowInfo;
            QString colInfo;

            if(pos.length()==3){
                rowInfo= pos.left(1);
                colInfo=pos.right(2);
            }else{
                rowInfo= pos.left(1);
                colInfo=pos.right(1);
            }

            QString finalPos = rowList[colInfo.toInt()-1]+ QString::number(columList.indexOf(rowInfo)+25);

            xlsx.write(finalPos,info);
        }

        xlsx.saveAs(filePath);
    }
    if(tabnum==1){
        on_pushButton_clicked();
    }else if(tabnum==2){
        on_pushButton_2_clicked();
    }else if(tabnum==3){
        on_pushButton_3_clicked();
    }else if(tabnum==4){
        on_pushButton_4_clicked();
    }else if(tabnum==5){
        on_pushButton_5_clicked();
    }
}

// 稀释方案
void DetectionAnalysis::xsui(int row,QString type,int tx){
    QTableWidgetItem *item = new QTableWidgetItem();
    item = ui->tableWidget_2->item(row,4);
    if(!(item == nullptr)){
        if(type=="常STR"){
            if(ui->tableWidget_2->item(row,4)->text()=="无"){
                ui->tableWidget_2->setItem(row,5,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,6,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,7,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,8,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,9,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,10,new QTableWidgetItem("无"));
            }else if(ui->tableWidget_2->item(row,4)->text().toInt()<=100){
                ui->tableWidget_2->setItem(row,5,new QTableWidgetItem(ui->tableWidget_2->item(row,4)->text()));
                ui->tableWidget_2->setItem(row,6,new QTableWidgetItem(QString::number(tx,'f',2)));
                ui->tableWidget_2->setItem(row,7,new QTableWidgetItem(QString::number(tx*ui->tableWidget_2->item(row,4)->text().toDouble()-tx,'f',2)));
                ui->tableWidget_2->setItem(row,8,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,9,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,10,new QTableWidgetItem("无"));
            }else if(ui->tableWidget_2->item(row,4)->text().toInt()<=1000&&ui->tableWidget_2->item(row,4)->text().toInt()>100){
                ui->tableWidget_2->setItem(row,5,new QTableWidgetItem(20));
                ui->tableWidget_2->setItem(row,6,new QTableWidgetItem(QString::number(tx,'f',2)));
                ui->tableWidget_2->setItem(row,7,new QTableWidgetItem(QString::number(tx*20-tx,'f',2)));
                ui->tableWidget_2->setItem(row,8,new QTableWidgetItem(QString::number(ui->tableWidget_2->item(row,4)->text().toDouble()/20,'f',2)));
                ui->tableWidget_2->setItem(row,9,new QTableWidgetItem(QString::number(tx,'f',2)));
                ui->tableWidget_2->setItem(row,10,new QTableWidgetItem(QString::number(tx*ui->tableWidget_2->item(row,4)->text().toDouble()/20-tx,'f',2)));
            }else if(ui->tableWidget_2->item(row,4)->text().toInt()>1000){
                ui->tableWidget_2->setItem(row,5,new QTableWidgetItem(QString::number(50)));
                ui->tableWidget_2->setItem(row,6,new QTableWidgetItem(QString::number(tx,'f',2)));
                ui->tableWidget_2->setItem(row,7,new QTableWidgetItem(QString::number(tx*50-tx,'f',2)));
                ui->tableWidget_2->setItem(row,8,new QTableWidgetItem(QString::number(ui->tableWidget_2->item(row,4)->text().toDouble()/50,'f',2)));
                ui->tableWidget_2->setItem(row,9,new QTableWidgetItem(QString::number(tx,'f',2)));
                ui->tableWidget_2->setItem(row,10,new QTableWidgetItem(QString::number(tx*ui->tableWidget_2->item(row,4)->text().toDouble()/50-tx,'f',2)));
            }
        }else if(type=="Y-STR"){
            if(ui->tableWidget_2->item(row,4)->text()=="无"){
                ui->tableWidget_2->setItem(row,5,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,6,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,7,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,8,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,9,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,10,new QTableWidgetItem("无"));
            }else if(ui->tableWidget_2->item(row,4)->text().toInt()<=100){
                ui->tableWidget_2->setItem(row,5,new QTableWidgetItem(ui->tableWidget_2->item(row,4)->text()));
                ui->tableWidget_2->setItem(row,6,new QTableWidgetItem(tx));
                ui->tableWidget_2->setItem(row,7,new QTableWidgetItem(tx*ui->tableWidget_2->item(row,4)->text().toInt()-tx));
                ui->tableWidget_2->setItem(row,8,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,9,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,10,new QTableWidgetItem("无"));
            }else if(ui->tableWidget_2->item(row,4)->text().toInt()<=1000&&ui->tableWidget_2->item(row,4)->text().toInt()>100){
                ui->tableWidget_2->setItem(row,5,new QTableWidgetItem(20));
                ui->tableWidget_2->setItem(row,6,new QTableWidgetItem(tx));
                ui->tableWidget_2->setItem(row,7,new QTableWidgetItem(tx*20-tx));
                ui->tableWidget_2->setItem(row,8,new QTableWidgetItem(ui->tableWidget_2->item(row,4)->text().toInt()/20));
                ui->tableWidget_2->setItem(row,9,new QTableWidgetItem(tx));
                ui->tableWidget_2->setItem(row,10,new QTableWidgetItem(tx*ui->tableWidget_2->item(row,4)->text().toInt()/20)-tx);
            }else if(ui->tableWidget_2->item(row,4)->text().toInt()>1000){
                ui->tableWidget_2->setItem(row,5,new QTableWidgetItem(50));
                ui->tableWidget_2->setItem(row,6,new QTableWidgetItem(tx));
                ui->tableWidget_2->setItem(row,7,new QTableWidgetItem(tx*50-tx));
                ui->tableWidget_2->setItem(row,8,new QTableWidgetItem(ui->tableWidget_2->item(row,4)->text().toInt()/50));
                ui->tableWidget_2->setItem(row,9,new QTableWidgetItem(tx));
                ui->tableWidget_2->setItem(row,10,new QTableWidgetItem(tx*ui->tableWidget_2->item(row,4)->text().toInt()/50)-tx);
            }
        }else if(type=="mini-STR"){
            if(ui->tableWidget_2->item(row,4)->text()=="无"){
                ui->tableWidget_2->setItem(row,5,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,6,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,7,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,8,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,9,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,10,new QTableWidgetItem("无"));
            }else if(ui->tableWidget_2->item(row,4)->text().toInt()<=100){
                ui->tableWidget_2->setItem(row,5,new QTableWidgetItem(ui->tableWidget_2->item(row,4)->text()));
                ui->tableWidget_2->setItem(row,6,new QTableWidgetItem(tx));
                ui->tableWidget_2->setItem(row,7,new QTableWidgetItem(tx*ui->tableWidget_2->item(row,4)->text().toInt()-tx));
                ui->tableWidget_2->setItem(row,8,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,9,new QTableWidgetItem("无"));
                ui->tableWidget_2->setItem(row,10,new QTableWidgetItem("无"));
            }else if(ui->tableWidget_2->item(row,4)->text().toInt()<=1000&&ui->tableWidget_2->item(row,4)->text().toInt()>100){
                ui->tableWidget_2->setItem(row,5,new QTableWidgetItem(20));
                ui->tableWidget_2->setItem(row,6,new QTableWidgetItem(tx));
                ui->tableWidget_2->setItem(row,7,new QTableWidgetItem(tx*20-tx));
                ui->tableWidget_2->setItem(row,8,new QTableWidgetItem(ui->tableWidget_2->item(row,4)->text().toInt()/20));
                ui->tableWidget_2->setItem(row,9,new QTableWidgetItem(tx));
                ui->tableWidget_2->setItem(row,10,new QTableWidgetItem(tx*ui->tableWidget_2->item(row,4)->text().toInt()/20)-tx);
            }else if(ui->tableWidget_2->item(row,4)->text().toInt()>1000){
                ui->tableWidget_2->setItem(row,5,new QTableWidgetItem(50));
                ui->tableWidget_2->setItem(row,6,new QTableWidgetItem(tx));
                ui->tableWidget_2->setItem(row,7,new QTableWidgetItem(tx*50-tx));
                ui->tableWidget_2->setItem(row,8,new QTableWidgetItem(ui->tableWidget_2->item(row,4)->text().toInt()/50));
                ui->tableWidget_2->setItem(row,9,new QTableWidgetItem(tx));
                ui->tableWidget_2->setItem(row,10,new QTableWidgetItem(tx*ui->tableWidget_2->item(row,4)->text().toInt()/50)-tx);
            }
        }
    }
}

void DetectionAnalysis::tab2xh(){
    for(int i=2;i<ui->tableWidget_2->rowCount();i++){
        ui->tableWidget_2->setItem(i,0,new QTableWidgetItem(QString::number(i-1)));
    }
}


void DetectionAnalysis::on_SaveBtn_clicked()
{
    emit changeTouploadfileWindow();
}
